Zen Cart Logo
Forums / General Questions / How might I separate my attributes from prod quantity?

How might I separate my attributes from prod quantity?

Views: 1,014

Results 1 to 7 of 7
17 Jun 2014, 10:54 PM
#1
casimir avatar

casimir

New Zenner

Join Date:
Jun 2014
Posts:
4
Plugin Contributions:
0

How might I separate my attributes from prod quantity?

Hi there,

For many of our products, we're using attributes as a way to allow customers to add-on to their purchase at the last moment. An example is bike chain (http://t-cycle.com/-p-35.html), which we sell by the foot: I'd like to give the customer the option to buy, at the same time, a number of connecting links, but don't want them to end up with 16x as many links as they'd chosen via the attribute.

I haven't been able to find a way to present the option for a customer to buy a set number of an attribute without that number being multiplied by the product quantity. Is there a fairly unobtrusive way to do this? If not, what's the obtrusive way of doing it?

In the link posted, the attribute has been disabled due to the problem herein discussed.

Thanks,

Casimir

18 Jun 2014, 2:42 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: How might I separate my attributes from prod quantity?

Mark the attribute as being a one-time charge, instead of an attribute price. Then, its cost will not be multiplied by the product quantity.

18 Jun 2014, 6:26 PM
#3
casimir avatar

casimir

New Zenner

Join Date:
Jun 2014
Posts:
4
Plugin Contributions:
0

Re: How might I separate my attributes from prod quantity?

Thank you, thank you.

I both hoped and feared it'd be that simple.

18 Jun 2014, 8:57 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: How might I separate my attributes from prod quantity?

You're very welcome. The one-time charge feature of the Zen Cart attributes is one that's easily overlooked!

18 Jun 2014, 9:08 PM
#5
casimir avatar

casimir

New Zenner

Join Date:
Jun 2014
Posts:
4
Plugin Contributions:
0

Re: How might I separate my attributes from prod quantity?

I appreciate the help, and have further question in the One Time Charge realm:

When I add an Attribute Price, it puts the additional price in parentheses, but when I add a One Time Charge, it just adds a space (e.g. http://t-cycle.com/-p-136.html, where the Radio attribute is an Attribute Price and has parentheses, but the second Dropdown attribute is a One Time Charge and the price is just beside the Option Value) which is wholly unappealing and slightly confusing; do you know wherein the PHP I should be looking to change that?

Thanks again!

18 Jun 2014, 9:47 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: How might I separate my attributes from prod quantity?

The attributes-formatting is provided by /includes/modules/attributes.php (which you can copy to /includes/modules/YOUR_TEMPLATE/attributes.php and make your template-override edits there) and /includes/templates/YOUR_TEMPLATE/TEMPLATES/tpl_modules_attributes.php.

18 Jun 2014, 10:38 PM
#7
casimir avatar

casimir

New Zenner

Join Date:
Jun 2014
Posts:
4
Plugin Contributions:
0

Re: How might I separate my attributes from prod quantity?

Thanks again, lat9!

For anyone else who's looking to add parentheses to the prices of their One Time Attribute Prices, you can use the ATTRIBUTES_PRICE_DELIMITER_PREFIX and SUFFIX to do it. I changed my /includes/modules/attributes.php from this:

                    if ($products_options->fields['attributes_price_onetime'] != 0 or $products_options->fields['attributes_price_factor_onetime'] != 0) {
                      $show_onetime_charges_description = 'true';
                      $new_onetime_charges = zen_get_attributes_price_final_onetime($products_options->fields["products_attributes_id"], 1, '');
                      $price_onetime = TEXT_ONETIME_CHARGE_SYMBOL . $currencies->display_price($new_onetime_charges, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
                    } else {
                      $price_onetime = '';
                    }

to this:

                    if ($products_options->fields['attributes_price_onetime'] != 0 or $products_options->fields['attributes_price_factor_onetime'] != 0) {
                      $show_onetime_charges_description = 'true';
                      $new_onetime_charges = zen_get_attributes_price_final_onetime($products_options->fields["products_attributes_id"], 1, '');
                      $price_onetime = ATTRIBUTES_PRICE_DELIMITER_PREFIX . $currencies->display_price($new_onetime_charges, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;
                    } else {
                      $price_onetime = '';
                    }

A note: I did away with the notifications of "* One time charges may apply," and therefore wasn't afraid to get rid of the "TEXT_ONETIME_CHARGE_SYMBOL" in the above code.