Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Attributes - Showing Value in Cart

Attributes - Showing Value in Cart

Started by bn17311 on 27 Nov 2012, 9:49 PM · Views: 1,439

Results 1 to 6 of 6
27 Nov 2012, 9:49 PM
#1
bn17311 avatar

bn17311

Zen Follower

Join Date:
Apr 2010
Posts:
319
Plugin Contributions:
0

Post #1 by bn17311

Hi,
in my attributes when viewing product you see if there is any money value added or subtracted

Attachment 11533

when added to cart it calculates the price, but is there any way to show the values after the listed attribute in the shopping cart page

Attachment 11534

thanks
Bryan

28 Nov 2012, 5:54 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #2 by ajeh

While this could confuse customers to see the break out of attribute prices mixed in the shopping cart, you could customize the file:
/includes/templates/your_templates_dir/templates/tpl_shopping_cart_default.php

and change the line:

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>

to read:

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']) . ' [ ' . $value['price_prefix'] . $currencies->format($value['options_values_price']) . ' ]'; ?></li>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Nov 2012, 9:58 PM
#3
bn17311 avatar

bn17311

Zen Follower

Join Date:
Apr 2010
Posts:
319
Plugin Contributions:
0

Post #3 by bn17311

thanks for reply, ill experiment with it but appreciate what your saying,

thanks
Bryan

30 Nov 2012, 11:42 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #4 by ajeh

To allow for specials and such on Attributes, you will need this adjusted with editing the file:
/includes/modules/pages/shopping_cart.php

      $attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.attributes_discounted[B], pa.products_attributes_id[/B]
                     FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                     WHERE pa.products_id = :productsID
                     AND pa.options_id = :optionsID
                     AND pa.options_id = popt.products_options_id
                     AND pa.options_values_id = :optionsValuesID
                     AND pa.options_values_id = poval.products_options_values_id
                     AND popt.language_id = :languageID
                     AND poval.language_id = :languageID " . $options_order_by;
[B]// bof: show attribute price in cart
      if ($attributes_values->fields['attributes_discounted'] == 1) {
        // apply product discount to attributes if discount is on
        //              $new_attributes_price = $products_options->fields['options_values_price'];
        $new_attributes_price = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, '', 'false');
        $new_attributes_price = zen_get_discount_calc((int)$products[$i]['id'], true, $new_attributes_price);
      } else {
        // discount is off do not apply
        $new_attributes_price = $attributes_values->fields['options_values_price'];
      }
      $attrArray[$option]['new_attributes_price'] = $new_attributes_price;
// eof: show attribute price in cart
[/B]
      $attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name'];

and then you can use one and/or the other in the template:

<!-- ORIGINAL <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li> -->
<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name'])[B] . ' [ ' . $value['price_prefix'] . $currencies->format($value['options_values_price']) . ' ] ' . $currencies->format($value['new_attributes_price'])[/B]; ?></li>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Dec 2012, 12:21 PM
#5
bn17311 avatar

bn17311

Zen Follower

Join Date:
Apr 2010
Posts:
319
Plugin Contributions:
0

Post #5 by bn17311

thanks for the help,

thanks
Bryan

3 Dec 2012, 2:46 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #6 by ajeh

You are most welcome ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!