Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Modifying product_info.php


rhubarb

Recommended Posts

There are a number of contributions which alter the way product attributes are selected and the closest one to what I need is probably Attributes option type selection

 

However I'm wanting to make a quick and simple mod for a specific site, I've changed the options to be displayed as checkboxes, and now I need the cart to be updated with the selected options; but how is this done?

 

In product_info.php I can't see any form tags so how are the user selections processed? It looks like the continue button has an href to index.php, does that page update the cart and then redirect to shopping_cart.php?

 

I see the following code in products_info.php but I believe this sets the selection state before displaying the options:

        if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }

Link to comment
Share on other sites

I now see that once the continue button is clicked then application_top.php checks the value of $HTTP_GET_VARS['action'] which is now set to 'add_product' , for which case the cart class 'add_cart' method is called.

Link to comment
Share on other sites

I've replaced a select box with 3x checkboxes, but only the name and value of the last checkbox is listed in the $attributes array which is passed to the cart class method 'add_cart' by application_top.php . That makes sense since a select box would only pass one selection as standard, but in my situation I want to be able to pass through names and values of all checkboxes.

 

I can't find where the attributes array, that is passed to the cart, is constructed.

Link to comment
Share on other sites

  • 2 months later...
I've replaced a select box with 3x checkboxes, but only the name and value of the last checkbox is listed in the $attributes array which is passed to the cart class method 'add_cart' by application_top.php . That makes sense since a select box would only pass one selection as standard, but in my situation I want to be able to pass through names and values of all checkboxes.

 

I can't find where the attributes array, that is passed to the cart, is constructed.

 

I'm looking to do this as well, and i'm having the same problem - did you have any luck?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...