Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Trying To Put An If Else Statement Based On Weight


Graveyard666

Recommended Posts

Posted

on my product_info.php page, I want a piece of code that pulls the weight of the item and if the weight=15.00 it then shows a statment for "oversize shipping" if it doesn't = that weight then nothing is shown but the code I have now isn't doing it.. here's what I have:

 

<?php if ($product_info_values['products_weight'] == 20.00): ?>
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_PRE_ORDER_POLICY) . '\\\')">' . 'pre-order policy' . '</a>'; ?>');
<?php endif; ?>

 

that's a piece of code for another if/else statement elsewhere in the file which DOES work, I just plugged in the db field and 20.00

 

then on line 67 it says:

 $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_weight, 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 . "'");

 

I added the p.products_weight but its not displaying at all

 

any help would be appreciated

Posted

It could be a few different things you are on the right track. Now I have seen in oscommerce if you don't put the if statement after the call to the database it wont work.

 

So ex:

 

 $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_weight, 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 . "'");

 

Then the iff statement

 

==========================

 

Also you can try putting a ' 20.00' like that. And also you might want to try seeing in the database table itself if the 20.00 is really 20.0000 like that sometimes the db does that but then the call limits the output to the call.

 

Hope this helps.

 

 

 

on my product_info.php page, I want a piece of code that pulls the weight of the item and if the weight=15.00 it then shows a statment for "oversize shipping" if it doesn't = that weight then nothing is shown but the code I have now isn't doing it.. here's what I have:

 

<?php if ($product_info_values['products_weight'] == 20.00): ?>
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_PRE_ORDER_POLICY) . '\\\')">' . 'pre-order policy' . '</a>'; ?>');
<?php endif; ?>

 

that's a piece of code for another if/else statement elsewhere in the file which DOES work, I just plugged in the db field and 20.00

 

then on line 67 it says:

 $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_weight, 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 . "'");

 

I added the p.products_weight but its not displaying at all

 

any help would be appreciated

Archived

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

×
×
  • Create New...