Jump to content
Latest News: (loading..)
Zappo

[Contribution] Option Types v2

Recommended Posts

I suppose somebody will rewrite the whole option types codebase.:huh:


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Hello,

I’m trying to install ‘Option Types vs for 2.3.4 Bugfix (8th March 2016)' into OSC 2.3.4 and encountering a problem when trying to run the SQL file on the database.

On running the SQL file I get a message “Import has been successfully finished, 7 queries executed. (OptionTypes v2 SQL.sql)” and an error message “#1062 - Duplicate entry '0' for key 'PRIMARY'”.

When I check in phpMyAdmin the alterations to tables have not been made. I would welcome any pointers or solutions where as to where I’m going wrong – please be mindful that my knowledge of working with databases is very limited!

Many thanks, Maz

Share this post


Link to post
Share on other sites

@mickamber

Hi Maz

I guess you're trying to insert the database entries using the Import feature via phpMyAdmin? Which means you click on the Browse... button and select the sql file.
First you need to remove the new field inside the configuration_group table. Browse to the configuration_group table and look for the Option Types field. Delete it.
Once that is done try to upload the sql file again but this time uncheck/ the checkbox of the following option.

Do not use AUTO_INCREMENT for zero values

 

Share this post


Link to post
Share on other sites

Lambros, thank you for your quick reply - followed your instructions and OptionTypes v2 SQL.sql is now successfully installed into the database. Yes, I was using using the import feature via phpMyAdmin.

I would never have worked it out without your help, so very many thanks, Maz.

Share this post


Link to post
Share on other sites

Hello all,

is this possible with option types?

I need a way for ms smith to enter dimensions in text fields, then add them together, then multiply by product price.

Example:

Product = wool= $1.00 per square inch

Lenght=[text field input] = 10.5"

Width=[text field input] = 6"

she adds to cart (10.5+6=16.5" x $1.00 per square) cart shows $16.50

Not sure if this should be done in product_info, option_types or maybe application_top.

Reading through all these forums, it looks like the text field is a temporary called [CUSTOMER INPUT], but my html calls the field like this:

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_7]" id="id[txt_7]" size="10" maxlength="10" value=""></div>

So, maybe it is a simple version of this in product_info:

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_7]" id="id[txt_7]" size="10" maxlength="10" value=""></div>

+

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_8]" id="id[txt_8]" size="10" maxlength="10" value=""></div>

*products_price?

Your thoughts would be greatly appriciated

 

osc v 2.3.4
addons
Option types for 2.3.4 v2
attribute prefix
 

Share this post


Link to post
Share on other sites
Posted (edited)

@2skys

Very interesting scenario.

First thing I did was take a look at various other fabric online stores to see how they sell their products. And it turns out most of them sell by the meter or yard with a predefined width. Width is in most cases 150cm.

Another thing to consider is stock tracking. With option types you add attributes and therefore you don't have the possibility to track stock of your fabric. What if you have only 10 square inch in stock but the customer wants 20 and can place an order in your shop even you don't have enough available?

To your question if it would be possible, i guess yes it is. It would take some research into the option types code but it should be doable.

Is this something you want for a certain product only or do you need this for most or even all products in your store?

Edited by Tsimi

Share this post


Link to post
Share on other sites
16 hours ago, 2skys said:

is this possible with option types?

Any type of custom price calculation based on options is possible, you just need to be clear how exactly the final price is "constructed"

Example

https://www.upnorthprint.com/product_info.php/a4-booklet-with-double-sided-cover-and-double-sided-bw-inners-on-white-paper-p-472

 

Share this post


Link to post
Share on other sites

Wow, thank you for your time and quick response!

To answer, it is a specific product.

It is custom embroidered boarders and trims for wall hangings, rugs, ornate table cloths, etc. They are sold by the linear inch. They will be offered in different color combinations, stitch patterns, embedded stones and widths.

The Product will be the material and boarder width (base price) then lenght + width (customer input) total x options (attribute prefix allows to multiply). 

Example:

Product = Silk = $1.00 per inch

Dimension1 = (customer input) = 10

Dimension2 = (customer input) = 15

Dimension3 = (customer input) = 10

adds to cart and shows $35.00 (or maybe can't show till all are picked?)

she picks options

1 color = Blue = 35 inches x .10 per inch ($3.50)

pattern#4 = egg&dart = 35 inches x 1.00 per inch ($35.00)

she adds to cart and totals all and shows $73.50 for this item before shipping

These are all custom so, no stock.

Not all are square shapes so maybe need dimension1, dimension2, dimension3, etc. for hex, oct, etc and maybe fractions (2 1/2").

Is this making sense?

 

Share this post


Link to post
Share on other sites
Posted (edited)

Yep making sense.
Not sure option types is the app to use though, at least not as is. The text input was made more for t-shirt or mug cup printing kinda feature. What you probably need is a quantity input field and not just one but 3 of them for dimensions 1,2 and 3 and then add additional attributes for the total of quantity 1-3.

Maybe someone can custom code it for you. Perhaps multimixer is  up for the task?
Or you can ask once in the commercial support section?

Something else... isn't square inch calculated length x width ? Just ask because in your first example you have

(10.5+6=16.5" x $1.00 per square) cart shows $16.50

shouldn't it be

(10.5x6=63" x $1.00 per square) = $63

Then again I am not really good at math so...

Edited by Tsimi

Share this post


Link to post
Share on other sites

Tsimi, you are correct, in the first example I did say square, but did correct it in the second. It is sold by the LINEAR INCH. Good catch.

So you think I need a qty for each dimension?

I found this: "oscom-attribute-qty-product-info-56XRs-3LyTZ". It changes the action of form to use a new action "/ case='add_mult'):", in doing so, it eliminates all drop down menu and lists each selection as a line item with a separate quantity.

Easy to install, maybe a good start for this? Note it adds the option value to the products price (for each qty), so it appears in the cart as individual products.

Matrox G200 MMS                                              $299.99

Available Options:

8 mb $349.99  16 mb $369.99  Premium $399.99 

Maybe a hack of this?

Then the issue becomes, I would only need to call  "/ case='add_mult'):" for a handful of products. The rest use drop downs. So now is it product_info1.php and product_info2.php (depending on the product), and if so, how do I call it?

Not sure how / where to start, if you or multimixer have ideas, all thoughts are appreciated.  "oscom-attribute-qty-product-info-56XRs-3LyTZ" is small so I copied here for your review.

BTW  thanks to all again.

:) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) 

***Editing Histoty****

10/24/2006 - by Jack_mcs
- Fixed bugs so it now works correctly

7/19/2005
-CHANGED APPLICATION TOP CODE/WAS NOT ADDING PRODUCTS W/OUT ATTRIBUTES.

***END EDITING HISTORY***


My first contrubution. Have not seen one like it, and my store needed it greatly.  
Many products with many attributes and did not want the customer to have to keep
going back to add more of a different attribute from the product info page.

You can email me kathyclem@yahoo.com with subject OSCommerce (otherwise I will delete it :) ).

This contrubution allows you to:

1. List the product attrubutes on the product_info.php page in a table instead of the pull-down menu.
2. Adds a quantity input box for each attribute.
3. Shows the actual price with the attribute instead of the '+/- XXX' 
   (easily edited if you do not like it, search for all instances of $price_with_attribute and change as necessary).
4. Lists the model number 
   (currently commented out, just search for 'uncomment if you want to show the model number' and uncomment.
    I run a hack that each attribute has a different model #)
5. I have this running with Seperate Pricing and it runs fine.
6. Currently working with just one attribute option type (ex. size or color; not both).  Had no need to edit
   it but if you want just make: 
      tep_draw_hidden_field('b[]',$products_options_name['products_options_id'])  in the product_info.php an array ; 
      then add another while or for loop in the application_top.php and it should work.

//////////////////////////////////////////////////////////////////////////////

Example 1 :

Option   Price    Quantity 
8 mb    $349.99      |_|

16 mb   $369.99      |_|


Example 2 :(with model uncommented):

Option    Model       Price    Quantity 
8 mb     123456      $349.99      |_|

16 mb    123457     $369.99      |_|

If you have a fresh install of OScommerce you may just copy the files over.

If you have other contributions installed, it is HIGHLY suggested that you follow the install 
instructions below for each file.

FIRST BACKUP! BACKUP! BACKUP! BACKUP! BACKUP! BACKUP! BACKUP! BACKUP! 

This contrub changes the following files:
catalog/product_info.php
catalog/includes/application_top.php
catalog/includes/languages/english/product_info.php

***************************BEGIN INSTALL********************************************************************************

**********************************
product_info.php
**********************************

Around line 47 (changing action of form to use new action / case='add_mult'):

Find:
    
    <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

REPLACE with:

       <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_mult')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

-----------------------------------------------------------------------------
Around line 48 (creating the layout of the table for attributes to go into):

Find:
            <tr>
        <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
          </tr>
        <?php

REPLACE with:
     <tr>
              <td class="main" align="center"><?php echo TEXT_PRODUCT_OPTION; ?></td>
          <td class="main" align="center"><?php /*  uncomment if you want to show the model number echo TEXT_PRODUCT_MODEL; */ ?></td>
          <td class="main" align="center"><?php echo TEXT_PRODUCT_PRICE; ?></td>
          <td class="main" align="center"><?php echo TEXT_PRODUCT_QUANTITY; ?></td>
     </tr>
    <?php
          $X=0;

-----------------------------------------------------------------------------
Around Line 138 (listing the attributes in table form):

Find:
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

Under this ADD ( before the } ):
       
    if ($products_options['price_prefix'] == '+') {
           $price_with_attribute = ($product_info['products_price'] + $products_options['options_values_price']);
    } else {
       $price_with_attribute = ($product_info['products_price'] - $products_options['options_values_price']);
       }
      ?>
            <tr>
              <td class="main" align="center">
            <?php echo $products_options['products_options_values_name'];
                  echo tep_draw_hidden_field('a[]', $products_options['products_options_values_id']);
                  echo tep_draw_hidden_field('b[]',$products_options_name['products_options_id']); ?>          </td>
          <td class="main" align="center">
        <?php /* uncomment if you want to show the model number
              echo $product_info['products_model']; */
         ?>
          </td>
              <td class="main" align="center"><?php echo $currencies->display_price($price_with_attribute, tep_get_tax_rate($product_info['products_tax_class_id'])); ?></td>
              <td class="main" align="center"><?php echo tep_draw_input_field('quantity[]',$value = '0',"size=2");?></td>
         </tr>
     <?php    
      $x++;

-----------------------------------------------------------------------------
Around Line 152 (removing the pull-down menu):
 
FIND & DELETE or COMMENT OUT:
    
    ?>
            <tr>
              <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
              <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
            </tr>
    <?php

**********************************
includes/application_top.php
**********************************
Around Line 330 (adding the new case of action='add_mult'):

Find:

// customer adds a product from the products page
case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

Above this ADD:
// customer adds multiple products from the product_info page
      case 'add_mult' : if (is_array($HTTP_POST_VARS['a'])){
                    reset($HTTP_POST_VARS['quantity']);
                    reset($HTTP_POST_VARS['a']);
                         $x=0;
                    
                          if (is_array($HTTP_POST_VARS['a'])){
                      foreach(($HTTP_POST_VARS['a']) as $key => $value){
                        $c = array((int)$HTTP_POST_VARS['b'][$x] => (int)$value);        
                    
                        if (is_array($HTTP_POST_VARS['quantity'])){
                          $qty = (int)$HTTP_POST_VARS['quantity'][$x];                   
                        $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], ($c)))+($qty),($c));
                        $x++;
                          }
                      } 
                    }
                  } else {
                    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                            $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                          }
                  }
                  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                        break;  

***************************
catalog/includes/languages/english/product_info.php
***************************

at the end of the file before last ?> 

ADD:    
    define('TEXT_PRODUCT_OPTION', 'Option');
    define('TEXT_PRODUCT_MODEL', 'Model');
    define('TEXT_PRODUCT_QUANTITY', 'Quantity');
    define('TEXT_PRODUCT_PRICE', 'Price');

Thats it!
:) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) 

osc v 2.3.4
addons
Option types for 2.3.4 v2
attribute prefix

Share this post


Link to post
Share on other sites

@2skys

I see we think alike. That was the first app I had a look at after our first conversation.
I got this already installed and running and as you already mentioned it removes/replaces all drop down options from the product page and replaces them with a table structure  and quantity input fields. What you need though is a combination of both.

I don't urge you to go get professional help, I know it can be expensive depending on the coder and work but it would be the quickest and cleanest way to do so.
The other option would be to fiddle around with it till you have a break through or something that gets you close, but that is time consuming and nerve racking at times since you got to work your way into the osC code and its functions.

What you can do is add another status switch in the admin section for those particular products and then in the product info page you can call for that status and then show what you need to. But still how do you get it to count Dimensions 1-3 together and then add additional attributes to it and then take over that total amount to the shopping cart?

I will look further into this when time allows but don't hold your breath.

Share this post


Link to post
Share on other sites

No worries, although everybody wants it yesterday, its my mom, she will wait (82 with patients).

I don't mind hacking at things (it's a good way to learn), I just not sure where? What do you mean "add another status switch in the admin section", how?

Glad to see we are looking "outside the box", again, thanks for the help.

Share this post


Link to post
Share on other sites
Posted (edited)

@2skys

In the admin area where the products are listed, every single product has a status setting, green for active and red for inactive.
This is then used in a query to check if a product is active or not, something like ...and products_status = 1...

This status function can be copied in the admin section (admin/categories.php file) and then you could use that to check for that status and if it is 1 show the custom code if it is 0 then show normal osC attributes/options.

For example add that new status check inside the database query of the product info file then check for that status like this

if ($product_info['custom_status'] == 1) {
  SHOW CUSTOM CODE	
} 

Maybe this is a bit over engineered but I always liked the possibility to switch things ON or OFF depending on product.
Another thing you gotta figure out is how to multiply a value or price in attributes. Stock osC only allows you to add or subtract a certain amount but not multiply it.

I'm not much of a help at the moment. I must admit I am not 100% familiar with every single osC code function and structure. Maybe try another search and look for different option possibilities? Multiply attributes price?

Search result 1

Search result 2

Edited by Tsimi

Share this post


Link to post
Share on other sites

Brilliant!

if ($product_info['custom_status'] == 1) {
  SHOW CUSTOM CODE	
} 

Let me see if I can figure it in.

As far as multiply, don't know if you caught in my first post, I have "attribute prefix" installed, this allows you to input "*" which multiplies option (actually a percentage) of product price. It needed alittle TLC to work and if you have more then 1 option that multiplies, it daisy chains. Example:

Product = $10.00

options

size2 = *.10

color4 = *.10

totals = $11.10 ($10.00 + $10.00 x .01=$1.00  +  .01 x .01=$0.10 = $11.10)

not $12.00 ($10.00 + $10.00 x .01=$1.00  +  $10.00 x .01=$1.00 = $12.00)

not sure why?

 

:) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) 

Attribute Percentage V 1.0 by Jack_mcs @ www.oscommerce-solution.com

Tested on osCommerce 2.2-CVS

This contribution allows product attributes to use a multiplication prefix.
This is useful where a multiple increase is required. 

Based on the Product Option of multiplication contribuiton.

/**************************************************************/
INSTALLATION:

1) Backup your shop.

/**************************************************************/
2) Copy the following into the includes/classes/currencies.php
   file before the last ?>.

    // BOC Attribute Percentage
    function format_percentage($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
      global $currency;

      if (empty($currency_type)) $currency_type = $currency;
      if ($calculate_currency_value == true) {
        $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
        $format_string = number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . "%";
// if the selected currency is in the european euro-conversion and the default currency is euro,
// the currency will displayed in the national currency and euro currency
        if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) {
          $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>';
        }
      } else {
        $format_string = number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . "%";
      }
 
      return $format_string;
    }    
    // EOC Attribute Percentage

    // BOC Attribute Percentage
    function display_price_percentage($products_price, $products_tax, $quantity = 1) {
      return $this->format_percentage(tep_add_tax($products_price, $products_tax) * $quantity);
    }    
    // EOC Attribute Percentage

/**************************************************************/
3) In includes/classes/shopping_cart.php

FIND (around line 230):
// attributes price
        if (isset($this->contents[$products_id]['attributes'])) {
          reset($this->contents[$products_id]['attributes']);

ADD THIS UNDER IT:
          // BOC Attribute Percentage
          $x_ctr = 0;
          // EOC Attribute Percentage  

FIND (around line 236):
            if ($attribute_price['price_prefix'] == '+') {
              $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
            } else {
              $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
            }
          }
        }
      }
    }

REPLACE WITH:
            if ($attribute_price['price_prefix'] == '+') {
              $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
            } else  if ($attribute_price['price_prefix'] == '-') {
              $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
            }   
            // BOC Attribute Percentage 
            else {  //if ($attribute_price['price_prefix'] == ATTRIBUTE_PERCENTAGE_SYMBOL)
              $x_ctr = $x_ctr + 1;
              
              if ($x_ctr <= 1) {
                $total_price = $products_price * tep_add_tax($attribute_price['options_values_price'], $products_tax);
              } else {
                $total_price = $total_price * tep_add_tax($attribute_price['options_values_price'], $products_tax);
              } 
              $this->total += $qty * tep_add_tax($total_price, $products_tax);
            }
            // BOC Attribute Percentage
          }
        }
      }
    }

FIND (around line 249):
        while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
          $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
          $attribute_price = tep_db_fetch_array($attribute_price_query);
          if ($attribute_price['price_prefix'] == '+') {
            $attributes_price += $attribute_price['options_values_price'];
          } else {
            $attributes_price -= $attribute_price['options_values_price'];
          }
        }
      }

REPLACE WITH THIS:
        // BOC Attribute Percentage
        $x_ctr = 0;
        $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $products_id . "' and status = '1'");
          // BOC Attribute Percentage
        while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
          $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
          $attribute_price = tep_db_fetch_array($attribute_price_query);         
          //----------------------------------------------------------------------------bof
          $temp_price_query = tep_db_query("select products_price from  " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
          $temp_price = tep_db_fetch_array($temp_price_query);
             
          $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $products_id . "' and status = '1'");
             
          if (tep_db_num_rows ($specials_query)) {
                  $specials = tep_db_fetch_array($specials_query);
               $temp_price['products_price'] = $specials['specials_new_products_price'];
          }
               
          if ($attribute_price['price_prefix'] == '+') {
             $attributes_price += $attribute_price['options_values_price'];
          }  
          if ($attribute_price['price_prefix'] == '-') {
             $attributes_price -= $attribute_price['options_values_price'];
          } 
          // BOC Attribute Percentage
          if ($attribute_price['price_prefix'] == ATTRIBUTE_PERCENTAGE_SYMBOL) {
             $x_ctr = $x_ctr + 1;
             
               if ($x_ctr <= 1) {
                 $attributes_price2 = $temp_price['products_price'] * ($attribute_price['options_values_price']);
                 $total_price = $attributes_price2;
            //   echo 'F '.$attributes_price2.'<br>';
               } else {
                  $attributes_price2 += $total_price * ($attribute_price['options_values_price']);
                  $total_price = $attributes_price2;
              // echo 'S '.$attributes_price2.'<br>';  
               }  
          }
        }
        if ($x_ctr >= 1) {
          $attributes_price += $attributes_price2;
        }
      }  
      // BOC Attribute Percentage

/**************************************************************/
4) In includes/languages/english.php, add the following before the last ?>.
// BOC Attribute Percentage
define('ATTRIBUTE_PERCENTAGE_SYMBOL', '*'); //change this to match the symbol you use in products attributes
// EOC Attribute Percentage

/**************************************************************/
5) In checkout_confirmation.php, 

FIND (around line 181):
    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
        echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

ADD THIS UNDER IT:
       // BOC Attribute Percentage
        if ($order->products[$i]['attributes'][$j]['price'] != '0') {
         if ($order->products[$i]['attributes'][$j]['prefix'] != ATTRIBUTE_PERCENTAGE_SYMBOL) { 
          echo ' (' . ($order->products[$i]['attributes'][$j]['prefix']) . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty']) . ')';
          echo '</i></small></nobr>';
         } else { 
          echo ' (' . ($order->products[$i]['attributes'][$j]['prefix']) . round($order->products[$i]['attributes'][$j]['price'],2) . '%' . ')';
          echo '</i></small></nobr>';
         }
        }        
        // BOC Attribute Percentage

/**************************************************************/
6) In product_info.php

FIND (around line 137):
          if ($products_options['options_values_price'] != '0') {

ADD THIS UNDER IT:
// BOC Attribute Percentage
       if ($products_options['price_prefix'] == ATTRIBUTE_PERCENTAGE_SYMBOL)
        $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price_percentage($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
       else
       // EOC Attribute Percentage
 
That's it.

/**************************************************************/
USAGE:
Create an attribute as you normally would except enter a * instead
of a + or - symbol. You can use whatever symbol you like to show 
the percentage. I prefer * but others like x. Whatever you choose, 
be sure to change the definition in the english.php file to match it.

The percentage should be entered in decimal format. So 10% is .1.

/**************************************************************/
HELP:
If you have any questions regarding this contribution, please ask
on the support thread located in this thread:
http://forums.oscommerce.com/index.php?showtopic=238973
 :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) 
  

osc v 2.3.4
addons
Option types for 2.3.4 v2
attribute prefix

Share this post


Link to post
Share on other sites
Posted (edited)

Oh cool! I didn't know about this attributes prefix app. Sounds like it does partially what you need. Still need some debugging though.

Then add an input field for attributes and you should be good?

How about this one here?

https://apps.oscommerce.com/p2EWu&quantity-for-product-attributes-mod

Never tried it myself.

So if you could get attributes prefix working with something like this quantity for attributes thing then you won't need this custom status stuff anymore since you will be able to use it as is without sacrificing the stock osC attributes drop downs.

Edited by Tsimi

Share this post


Link to post
Share on other sites


Installed this https://apps.oscommerce.com/p2EWu&quantity-for-product-attributes-mod and found it full of errors. When all are corrected, I do not see the change, it still
maintains the attribute qty to the product qty?
Thanks Tsimi, but I think it the wrong direction. I like the direction you suggested

"For example add that new status check inside the database query of the product info file then check for that status like this"

if ($product_info['custom_status'] == 1) {
  SHOW CUSTOM CODE    

So maybe a produt_info_2.php that gets called by a status or maybe easier, a manufacturer "-custom", then, product_info_2.php adds

 [CUSTOMER INPUT] + [CUSTOMER INPUT] + [CUSTOMER INPUT] * products_price (a base price per inch)


or a selected option

 [CUSTOMER INPUT] + [CUSTOMER INPUT] + [CUSTOMER INPUT] * option_value_price (which would simply include a base price)

So this brings me back to original post
======================================================
Reading through all these forums, it looks like the text field is a temporary called [CUSTOMER INPUT], but my html calls the field like this:

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_7]" id="id[txt_7]" size="10" maxlength="10" value=""></div>

So, maybe it is a simple version of this in product_info:

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_7]" id="id[txt_7]" size="10" maxlength="10" value=""></div>

+

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_8]" id="id[txt_8]" size="10" maxlength="10" value=""></div>

*products_price?

Your thoughts would be greatly appriciated

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

Is it possible to add  [CUSTOMER INPUT] +  [CUSTOMER INPUT] +  [CUSTOMER INPUT] and then *,

If so, could you get me started, please?

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

@2skys

One thing is sure you can't use the Option Types CUSTOMER_INPUT to do it. That is not a real value that can be calculated.
You need a quantity input field of some sort.

I got as far as creating 3 custom quantity input fields and then calculate the percentage of the attributes to those 3 input fields total. The main problem was once the item has been added to the cart you could not see the input fields separately listed so you as shop wouldn't know what length, width or any other dimension the customer would have chosen. That is why this is best done as attribute.

You really should consider to contact multimixer and just ask how much he wants for that function he has shown in the paper printing shop. Asking is free so...
Or maybe try to get a quote in the commercial support section. There again, asking is free.

 

Share this post


Link to post
Share on other sites

Thank you,

I did not realize this one was that difficult seeing some of the addons you guys do. Thank you for pointing out "CUSTOMER_INPUT" is the wrong direction.


addons
Option types for 2.3.4 v2
attribute prefix

Share this post


Link to post
Share on other sites

 

So, if the CUSTOM product page source contains:

<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[txt_7]" id="id[txt_7]" size="10" maxlength="10" value=""></div>

and I call my hard code product_info2 by using manufacturer field, maybe like this?

 // CUSTOM
    if (  (MANUFACTURER_NAME != '-CUSTOM')&& ($manufacturer_name == -CUSTOM)  ) {
      tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO2));
    }

and product_info2 reads like:

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

or something?

Then it would show correct in cart and invoice?

Still way off?

 

 

Share this post


Link to post
Share on other sites

Can anyone tell me if I am on the right track here:

 // CUSTOM

  include(FILENAME_PRODUCT_INFO2 . 'product_info2.php');
          ob_start();
          $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
    if (MANUFACTURERS_NAME == 'CUSTOM') {
 $goto =  FILENAME_PRODUCT_INFO2;
      $parameters = array('action', 'cPath', 'products_id', 'pid');

    }

:) :) :) :) :) :) :):) :) :) :) :) :) :):) :) :) :) :) :) :):) :) :) :) :) :) :)     or     :) :) :) :) :) :) :):) :) :) :) :) :) :):) :) :) :) :) :) :)

// CUSTOM
          $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
   if (tep_not_null($manufacturers['manufacturers_name'])&& ($manufacturers_name == 'CUSTOM')  ) {
    tep_href_link(FILENAME_PRODUCT_INFO2, 'products_id='.$product_info['products_id']);

    }

 

and product_info2.php defined in filename.php. Both are not throwing error, but not changing page from product_info.php to product_info2.php when manufacturers name is CUSTOM.

 

Any help would be appreciated :)

Share this post


Link to post
Share on other sites

This line doesn't make any sense to me

include(FILENAME_PRODUCT_INFO2 . 'product_info2.php');

Presumably, FILENAME_PRODUCT_INFO2 is defined as 'product_info2.php' so that statement says to load the file product_info2.phpproduct_info2.php. You may have meant

define(FILENAME_PRODUCT_INFO2 . 'product_info2.php');

And nothing is done with the $manufacturers_query variable. You need to fetch the results of that call. Something like the following may be what you need:

  $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
  while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { 
     if ($manufacturers['manufacturers_name'] == 'CUSTOM') {
        $goto = 'product_info2.php';
        $parameters = array('action', 'cPath', 'products_id', 'pid');         
        break;
    } 
  }
    

 

Share this post


Link to post
Share on other sites

Got you, so

define('FILENAME_PRODUCT_INFO2', 'product_info2.php'); is in filename.php

and this:

 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
  while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { 
     if ($manufacturers['manufacturers_name'] == 'CUSTOM') {
        $goto = 'product_info2.php';
        $parameters = array('action', 'cPath', 'products_id', 'pid');         
        break;
    } 
  }

in product_info.php, no errors, but sad, no change when products manufacturer is CUSTOM.

playing around abit, if I change:

if ($manufacturers['manufacturers_name'] == 'CUSTOM') {

to:

if ($manufacturers_query['manufacturers_name'] == 'CUSTOM') {

now all product_info is blank, page still does not change to product_info2.php, but at least a reaction.

 

Jack I am grateful you have looked

 

 

osc v 2.3.4
addons
Option types for 2.3.4 v2
attribute prefix

Share this post


Link to post
Share on other sites

Hi,

I have installed BS AjaxAngular Professional ShoppingCart, Options as Image, So far it seems there is not problem.

And now I am trying to integrate the shop with Option Types.

I tried checkbox with two options, it can get one value(I used print($products); to see), but I can select two.

Are there no codes to force the checkbox only can select one? or there are. it seems that I couldn't find it in the instructions.

Thanks in advanced.

chuntse

 

 

Share this post


Link to post
Share on other sites
1 hour ago, chuntse said:

Are there no codes to force the checkbox only can select one? or there are. it seems that I couldn't find it in the instructions.

If you need only one selection then why not use radio buttons instead?

Share this post


Link to post
Share on other sites
Posted (edited)

@Tsimi

Thanks for your kind reply.

Surely I want it to be multiple selectiom, but I don't why it can only transfer one value of checkbox to shopping cart when I selected two.As I used print_r($products); to check.

Does it have this kind of problem of BS version at your side?

Chuntse

Edited by chuntse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×