Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy PHP Question.


Gold!

Recommended Posts

Posted

I would like to use the product weight value in the product_info.php file.

 

How would I go upon changing the code so I can use the weight value throughout the page.

 

Please help.

Posted

line 72

    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, 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 . "'");

within the select statement you need to add p.products_weight

 

then afterwards you can refer to it as

$product_info['products_weight']

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted

Ok, round 2 of loading the weight variable.

 

Right now I am in product_listing.php. I have tried to use $listing['products_weight'] in place of $product_info['products_weight'] because I figured it was already on the page so it should be loaded correctly. However this only seems to work when i have the Weight column activated through the admin pannel.

 

Can anyone explain why this is happening? and how can I initialize the weight variable in product_listing.php without having the weight column activated?

Posted

I would really appreciate it if somone could take some time to answer my second question.

 

This is a must have to get my store off the ground, :unsure:

Posted

the product_listing.php file is embedded in the following files:

- index.php

- advanced_search_results.php

 

In both of these files, there is a case statement to include p.products_weight in the sql selection when this field is enabled.

Just change this code to not check for enabled/disabled, but always include it.

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...