Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Smart coders help me out Please?


RyanSmith

Recommended Posts

Posted

I have been trying to add some custom code to pull certain options from new tables that I created in the database. I'm moving along pretty well, but I've gotten to a point where I'm not sure whats going on, and I want to be sure that I'm doing this right. I'm in shopping_cart.php right now, and I'm adding some custom code to display my attributes. I can't quite figure out what the hidden fields do.

 

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

 

 

Does anyone know what these are here for? My full code looks like this:

 

if (strstr($value, "nd")) {

//Get name drop ID

$nd_val = substr($value, 3);

//Run query to get actual values

$nd = tep_db_query("select * from name_drop where name_drop_id = " . $nd_val);

//Get array of values

$att_vals = tep_db_fetch_array($nd);

//Create the attribute in the format (line1 :: line2 :: logoID)

$attr_value = $att_vals['line1'] . ' :: ' . $att_vals['line2'] . ' :: ' . $att_vals['logo'];

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . 'nd_' . $option . ']', $attr_value);

} else if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID){

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);

$attr_value = $products[$i]['attributes_values'][$option];

} else {

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attr_value = $attributes_values['products_options_values_name'];

}

 

 

If anyone sees something wrong with this. I would also love some advice.

 

Thanks

osCommerce is a great piece of software with wonderful contributions.

Spend some time in the contribution area. There are a lot of gems there.

Posted

It is just a way to pass the particular product taking its attributes into consideration (color, size, etc.). If you don't use attibutes then those values should be empty and will be ignored.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted
It is just a way to pass the particular product taking its attributes into consideration (color, size, etc.).  If you don't use attibutes then those values should be empty and will be ignored.

 

Jack

 

Thanks, I'm creating my own custom attributes that get pulled from a new database table. I've gotten to the point where it looks good on the shopping_cart page, and I think that it's getting inserted into the customers_basket_attributes ok as well, but after I leave the shopping_cart page, it isn't quite working.

 

I'm still trying to hack through the code to figure out whats going on.

 

Thanks for your reply.

osCommerce is a great piece of software with wonderful contributions.

Spend some time in the contribution area. There are a lot of gems there.

Archived

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

×
×
  • Create New...