Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Type Feature v1.4 (for osc 2.2 ms1)


Guest

Recommended Posts

  • Replies 192
  • Created
  • Last Reply

Top Posters In This Topic

Going down the wrong road here! Too many conlicts.

 

somehow its going to have to be modification to chandras Mod.

you can't use contre's code for it, as there seems to be too many forks in code at the same place.

What goes up MUST come down

Link to comment
Share on other sites

0-0

 

All eyes on you !! Good luck

 

Another little gem!

 

An attribute that has a value, get multiplied by the product quantity. How do you get an attribute to just add the value so it does'nt change when you input 30 products against 1 product.

 

This is driving me mad!

What goes up MUST come down

Link to comment
Share on other sites

Did i read somewhere that someone had the admin side of this mod completed.

 

if so are there any changes between this and chandras admin side

 

cheers

barry

Link to comment
Share on other sites

Yes there are some, will upload them this afternoon.

The problem seems not to be in the admin area. i considered problems with the catalo/product_info and catalog/shopping_cart, receiving lots of parse-errors or "nothing"

 

conte handles the different option-types as cases right now i'm trying to add a new case, using the other cases (from conte) as reference. without modifying the rest of contes file.

 

I'll let you know in a few

Link to comment
Share on other sites

catalog/product_info.php WWOOOOORKS

 

Needs only a little tuning

 

now lets check the shopping_cart, puh

 

how you getting on, i have product_info.php showing the attributes but it won't let me add anything to the cart i think it have something to do with the switch/case statement.

 

mmmmm

 

cheers

barry

Link to comment
Share on other sites

ok i got it working all but one thing.

 

I am just working on how to display more than one checkbox at a time, other wiswe it is working, all attributes get added to the basket and you can checkout.

 

you can see this working on my test site (address below) and the attributes are set up on 'A Bugs Life'

 

 

cheers

barry

Link to comment
Share on other sites

i have got it to now display more than one checkbox on product info but it is only adding one to the cart.

 

I added a while statement into product info to get the extra checkboxes.

 

The saga continues.

 

cheers

barry

Link to comment
Share on other sites

 case ($products_options_name['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX):



             //CLR 2003-03-18 Add logic for checkboxes

             $products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");

             $products_attribs_array = tep_db_fetch_array($products_attribs_query);

             echo '<tr><td class="main" valign="top">' . $products_options_name['products_options_name'] . ': </td><td class="main">';

             $products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

            echo '<tr><td class="main"><br><b>' . $products_options_name_values['products_options_name'] . ':</b></td><td> </td></tr>' . "n";

            while ($products_options_values = tep_db_fetch_array($products_options)) {

              //$linked_attrib = tep_linked_attributes($products_options_values['0'],$HTTP_GET_VARS['products_id']);

              $name_checkbox = 'id[' . $products_options_name['products_options_id'] . ']';

              $value_checkbox = $products_options_values['products_options_values_id'];



              if (strchr($products_options_values['price_prefix'],'s')) {

                $special_class = 'productSpecialPrice';

              } else {

                $special_class = 'main';

              }

              echo '<tr><td class="' . $special_class . '">  ' . $products_options_values['products_options_values_name'];

              if (($products_options_values['options_values_price'] != '0') && (!strchr($products_options_values['price_prefix'],'i'))) {

                echo ' (' . tep_prefix_view($products_options_values['price_prefix']) . ' '. $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

              }

              echo '</td><td>' . tep_draw_checkbox_field($name_checkbox, $value_checkbox) . '</td></tr>' . "n";

            }

       break;

 

 

 

this is how i had mine displaying more than one checkbox

however it would not add more than one of them to the cart.

 

 

 

if you know how to fix that problem let me know

 

i have 62 mods on my shopping cart

and its becomming a real pain to add

contributions.

Link to comment
Share on other sites

here is how i have implemented it

 

      case ($products_options_name['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX): 

         //CLR 2003-03-18 Add logic for checkboxes 

         $products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");                        

         while ($products_attribs_array = tep_db_fetch_array($products_attribs_query)) { 

         echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">'; 

         echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);            

         echo $products_options_name['products_options_comment']; 

         if ($products_attribs_array['options_values_price'] != '0') { 

           echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], $product_info_values['products_tax_class_id']) .') '; 

         }

   } 

         echo '</td></tr>'; 

       break;

 

and i've tried yours and it solves a problem i had that although i was getting the right amount of checkboxes the option name was not displayed. Thank you.

 

I think that between the others participating on this thread i'm sure we could sort this mod to give us full functionality. :)

 

I too have a lot of mods installed and it can be a bit mindboggling at times. :?

 

cheers

barry

Link to comment
Share on other sites

ok i've figured it out, well what the problem is anyway, and i'm working on a solution.

 

The reason this happens is because when the checkbox is drawn the name is assigned based on the product options id in my store i have 1 checkbox set up with name top, it has an id of 7.

 

When i add 1 to a product, 1 shows up in product_info.php and one gets added to the cart.

When i add 2 to a product, 2 show up in product_info.php and only one gets added to the cart.

 

What i have done so far is modify the code to look like this;

 

case ($products_options_name['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX): 



                 //CLR 2003-03-18 Add logic for checkboxes 

                 $products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'"); 

                 $products_attribs_array = tep_db_fetch_array($products_attribs_query); 

                 echo '<tr><td class="main" valign="top">' . $products_options_name['products_options_name'] . ': </td><td class="main">'; 

                 $products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); 

                      echo '<tr><td class="main"><br><b>' . $products_options_name_values['products_options_name'] . ':</b></td><td> </td></tr>' . "n"; 

                      $turn='';

       while ($products_options_values = tep_db_fetch_array($products_options)) { 

        //$linked_attrib = tep_linked_attributes($products_options_values['0'],$HTTP_GET_VARS['products_id']); 

                        $name_checkbox = 'id[' . $products_options_name['products_options_id'] . $turn . ']'; 

                        $value_checkbox = $products_options_values['products_options_values_id']; 



                        if (strchr($products_options_values['price_prefix'],'s')) { 

                          $special_class = 'productSpecialPrice'; 

                        } else { 

                          $special_class = 'main'; 

                        } 

                        echo '<tr><td class="' . $special_class . '">  ' . $products_options_values['products_options_values_name']; 

                        if (($products_options_values['options_values_price'] != '0') && (!strchr($products_options_values['price_prefix'],'i'))) { 

                          echo ' (' . tep_prefix_view($products_options_values['price_prefix']) . ' '. $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; 

                        } 

                        echo '</td><td>' . tep_draw_checkbox_field($name_checkbox, $value_checkbox) . '</td></tr>' . "n"; 

                      $turn++;

       }

 

i added a variable define for $turn, set it to zero and then appended it to the checkbox 'id' like this;

 

$name_checkbox = 'id[' . $products_options_name['products_options_id'] . $turn . ']';

 

then i incremented it at the bottom using

 

$turn++;

 

if you go to my test site and go to A bugs life, try it out and see the results.

This code change adds one of the checkboxes to the cart and a blank attribute to the cart, you'll see this if you try it.

 

looking for more ideas.

 

 

cheers

barry

Link to comment
Share on other sites

Is this right?

tep_linked_attributes($products_options_values['0'],$HTTP_GET_VARS['products_id']); 

                        $name_checkbox = 'id[' .

 

i don't think that needs to be there, i have used the code that tekdesigns posted earlier for the checkbox section, which looks like it came from contre's mod, that's not what's causing the problem though.

 

cheers

barry

Link to comment
Share on other sites

The product info.php was the one of the Files that seemed to 'merge'

product_info.php

 

 

case '2' : // checkbox

$products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.collegamento from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' and pa.options_type_id = 2 order by pa.attribute_order");

echo '<tr><td class="main"><br><b>' . $products_options_name_values['products_options_name'] . ':</b></td><td> </td></tr>' . "n";

while ($products_options_values = tep_db_fetch_array($products_options)) {

$linked_attrib = tep_linked_attributes($products_options_values['collegamento'],$HTTP_GET_VARS['products_id']);

$selected = false;

$name_checkbox = 'id[]';

$value_checkbox = '{' . $products_options_name_values['products_options_id'] . '}' . $products_options_values['products_options_values_id'] . $linked_attrib;

for ($ciclo=0;$ciclo<sizeof($cart->contents[$HTTP_GET_VARS['products_id']]['attributes']);$ciclo++) {

if ($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ciclo][$products_options_name_values['products_options_id']] == $products_options_values['products_options_values_id']) {

$selected = true;

}

 

 

and so on

 

and the order detail_php

 

order_details.php

// Delete box only for shopping cart

if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

echo ' <td align="center" valign="top">' . tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']) . '</td>' . "n";

}

 

there should be a solution in contres mod

What goes up MUST come down

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...