osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Variable Help!!

This is a discussion on Variable Help!! within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; Hi, I'm new with osCMax and could use a bit of help. My customer wanted a field when he was ...



Find us on Facebook
Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Customization/Mods

Connect with Facebook Register FAQDonate Members List Calendar Mark Forums Read


Reply

 

LinkBack Thread Tools
  #1  
Old 03-12-2010, 10:17 AM
New Member
 
Join Date: Jan 2010
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0
aking1001 is on a distinguished road
Default Variable Help!!

Hi, I'm new with osCMax and could use a bit of help.

My customer wanted a field when he was adding new products that would indicate by what measure they were being sold (ex - by box, by pound, by kilogram, by the dozen, etc).

I have successful added a new form field to the admin page categories.php and I have it saving the data to a new field in the database. So far so good!

However, I can NOT get the new information to display on the front end by editing product_info.tpl.php

I am using a piece of code identical to this:

<?php echo $products_format; ?>

I believe the data isn't being initialized / captured / loaded as a variable I can display.

HELP!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-12-2010, 11:57 AM
ridexbuilder's Avatar
osCMax Development Team

 
Join Date: Jul 2008
Location: Haggisland
Posts: 1,624
Thanks: 152
Thanked 192 Times in 181 Posts
Rep Power: 13
ridexbuilder is a splendid one to beholdridexbuilder is a splendid one to beholdridexbuilder is a splendid one to beholdridexbuilder is a splendid one to beholdridexbuilder is a splendid one to beholdridexbuilder is a splendid one to beholdridexbuilder is a splendid one to beholdridexbuilder is a splendid one to behold
Post Re: Variable Help!!

You need to retrieve the data, along with everything else, in the select statement.
__________________
Hosting plans with installation, configuration, contributions, support and maintenance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 03-12-2010, 12:10 PM
New Member
 
Join Date: Feb 2010
Posts: 9
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 0
wowsaver is on a distinguished road
Default Re: Variable Help!!

if you have your new field added to products table:

Code:
    $product_info_query = tep_db_query("select p.products_format,p.products_id, pd.products_name, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);
if you have your new field added to products description table:
Code:
    $product_info_query = tep_db_query("select pd.products_format,p.products_id, pd.products_name, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 03-13-2010, 06:35 AM
New Member
 
Join Date: Jan 2010
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0
aking1001 is on a distinguished road
Default Re: Variable Help!!

Thanks for the responses.

It's in the products table. I have added the code as wowsaver suggested -- still nothing!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 03-13-2010, 07:44 AM
pgmarshall's Avatar
osCMax Development Team
 
Join Date: Feb 2009
Location: London
Posts: 1,156
Thanks: 63
Thanked 245 Times in 210 Posts
Rep Power: 15
pgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud of
Default Re: Variable Help!!

If you read the post again you will notice.

Quote:
if you have your new field added to products description table
Whereas you have put the extra field in the products table not products_description.

Just change the select to be p.products_format not pd.products_format

Regards,
__________________
pgmarshall
_______________________________
Test Site: www.cottonbarn.info

Want to say thank you if I helped you out? Help me block this waste incinerator plan (www.nywag.org) in North Yorkshire, UK. Sign the petition here (only takes 1 minute). Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 03-13-2010, 08:32 AM
New Member
 
Join Date: Jan 2010
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0
aking1001 is on a distinguished road
Default Re: Variable Help!!

The product_info_query uses p.products_format. No luck.

On the product_info.tpl.php page I've tried:

<?php echo $products_price; ?> -- nothing;

<?php echo $p.products_price; ?> -- prints the term "products_price"

<?php echo $products_info['products_format']; ?> -- nothing;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 03-13-2010, 10:50 AM
New Member
 
Join Date: Feb 2010
Posts: 9
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 0
wowsaver is on a distinguished road
Default Re: Variable Help!!

let's say your new field is in products table with the field name products_format

Use this statement in your product_info.tpl.php
(replace the one at about line 33)


Code:
$product_info_query = tep_db_query("select p.products_format,p.products_id, pd.products_name, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);
then echo:
Code:
<?php $product_info['products_format']; ?>
If you have still problems make sure your cleared your cache and your cookies.
check in your database that you actually have the field products_format in your products table and see if you have any value for this field.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to wowsaver For This Useful Post:
aking1001 (03-15-2010)
  #8  
Old 03-13-2010, 11:31 AM
New Member
 
Join Date: Jan 2010
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0
aking1001 is on a distinguished road
Default Re: Variable Help!!

Wowsaver, you are a lifesaver! It finally worked!

Thanks very much!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 03-13-2010, 11:36 PM
pgmarshall's Avatar
osCMax Development Team
 
Join Date: Feb 2009
Location: London
Posts: 1,156
Thanks: 63
Thanked 245 Times in 210 Posts
Rep Power: 15
pgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud ofpgmarshall has much to be proud of
Smile Re: Variable Help!!

Glad to hear you got it to work ...

Don't forget to click the button (bottom right) to say "thanks" to wowsaver.

Regards,
__________________
pgmarshall
_______________________________
Test Site: www.cottonbarn.info

Want to say thank you if I helped you out? Help me block this waste incinerator plan (www.nywag.org) in North Yorkshire, UK. Sign the petition here (only takes 1 minute). Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to pgmarshall For This Useful Post:
aking1001 (03-15-2010)
Reply

Tags
variables

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
PHP Help Needed - How to get the value of a variable ASasek osCommerce 2.2 Modification Help 1 05-19-2006 05:08 AM
variable shipping based on weight and price darren777 osCommerce 2.2 Modification Help 0 11-01-2005 08:16 AM
variable free shipping rate per country mattkern osCMax v1.7 General Mods Discussion 1 12-17-2004 03:26 PM
Increasing Session Variable sizes? ryanmhubbard osCMax v1.7 Discussion 0 09-30-2004 08:35 AM
Heavy problems with passed variable and member function Markus osCommerce 2.2 Installation Help 2 09-15-2003 06:24 AM


All times are GMT -8. The time now is 07:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2010 osCmax
Inactive Reminders By Icora Web Design