Forums / Templates, Stylesheets, Page Layout / How can I show the attribute weight for each item in cart?

How can I show the attribute weight for each item in cart?

Locked

Views: 5,123

Results 1 to 20 of 41
This thread is locked. New replies are disabled.
31 Aug 2007, 10:00 PM
#1
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

How can I show the attribute weight for each item in cart?

In the shopping cart it adds the total weight up top amount as we know based on the option value weight.

I want to also show the individual attribute weight for each item.

So for instance attributes for delivery veggie product:

option name= spinach + checkbox + option value weight = + 1 lb

when cart viewed the listing does not include the option value weight

it merely says - spinach-

I want it to say - spinach- 1 lb.

As it adds the poundage up at top why not show the individual weight amounts listed for each attribute as well?

Thanks ahead of time. I am almost done with cart and this is the last to go!

1 Sep 2007, 1:09 AM
#2
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . $value['products_attributes_weight']; ?></li>

this is on the tpl_shopping_cart_default.php where it lists the product option name with the -

I added the value products attributes weight as that is what the filed name is in the database

Does not render though - anybody with ideas?

Thanks

I hope I can crack this.

1 Sep 2007, 1:19 AM
#3
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

Sounds like you turned it off ...

Catalog ... Product Types ... Edit Layout button ...

Show Attribute Weight
Display Attribute Weight on Product Info 0= off 1= on

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!

1 Sep 2007, 1:55 AM
#4
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Hi - and thanks - sorry for the bother - great for a reply!

It is turned on - I want to show the option value weight in the actual cart page for each product attribute.

Like this

product info page

Produce Box

Options
Bananas CHECK BOX (+1.5lbs)

add to cart

then go to cart

Produce Box

  • Bananas -

Bananas has an individual weight of 1.5 lbs. that I specified in the weight box for the option in attributes.

I want to show the individual weight next to the option selected in the actual cart page. Make sense?

I can send a URL if it helps - appreciate it so much.

1 Sep 2007, 1:57 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

Could you switch to Classic Template and see if it is working to rule out your template?

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!

1 Sep 2007, 2:01 AM
#6
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

I am using Classic template

Seems so simple to list the weight next to option in cart???

  • Bananas - 1.5 lbs.

It should call the products_attributes_weight

1 Sep 2007, 2:04 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

Zen Cart is designed to show the weight ...

You add an Attribute you enter the weight ... voila! :smile:

Your weight is not working ... you have customize the default template so it is hard to know what else you have changed to affect this ...

If you see the attribute weight in the Attributes Controller ... and you have set the Product Type setting to show the weight ... then either you have:

1 turned this off by changing code

2 turned this off by deleting code

3 turned this off in the stylesheet

Have you an URL to a Product where the Attribute is setup with weight but is not showing?

How much does the Product weigh?

How much does the Attribute weigh?

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!

1 Sep 2007, 2:17 AM
#8
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Okay - I uploaded original tpl shopping default again to no avail.

I don't think its css and I have not done any major mods to any pages.

Here is the URL - there is no product weight - just individual weights for each product option

View in IE if you please - I am still fudging with Firefox views - float is off

http://vinestreetworks.com/test/index.php?main_page=product_info&cPath=1&products_id=1

when you add the options - no weight shows in cart as said -

THE TOTAL WEIGHT SHOWS UP TOP OF COURSE - I want to show the individual weights for each option listed under the product

so many thanks

1 Sep 2007, 2:19 AM
#9
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

I see attribute weights on both IE 6.x and FireFox 2.x ... umm ... perhaps close your browser windows, clear your cache and look again ... :unsure:

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!

1 Sep 2007, 2:21 AM
#10
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Yes I see them too but when you add to the cart it doesn't show individual weight next to option

Weights show on product info page but not in actual shopping cart it just has the option name with a -

1 Sep 2007, 2:23 AM
#11
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

Oh ... well ... never mind ... :lamo:

Nope, they are not broken out in the shopping cart as the product weight is not broken out in the shopping cart either ...

This could be done, but it would take quite a bit of custom coding ... have you got your coder's hat on? :smartalec:

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!

1 Sep 2007, 2:31 AM
#12
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Yes I am a pretty good manipulator of code -

in tpl_shipping_default.php is where the mod must take place I believe

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

It should call the products_attributes_weight here but I cannot get it to show - more to this I know

There is a attribute in attributes controller

<input type="text" name="products_attributes_weight_prefix" value="<?php echo $attributes_values->fields['products_attributes_weight_prefix']; ?>" size="2"> <input type="text" name="products_attributes_weight" value="<?php echo $attributes_values->fields['products_attributes_weight']; ?>" size="6">

1 Sep 2007, 2:53 AM
#13
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Want to be able to have the poundage show so I know what to put into each box

Anyway thanks for your help and thoughts - guess I will have to either re-think this or hire a coder who knows this better:(

I did another way for hours setting up weights as option values but then thought why not use the weight feature - blah

It seems to make sense if you offer the options for individual weights in attributes they should be shown everywhere

The product totals display reads the formula with the products_attributes_weight for each option when its added up top in total weight

wish I could just parse the weight into the final list in cart

:cry:

1 Sep 2007, 3:27 AM
#14
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

You can customize the file:
/includes/modules/pages/shopping_cart/header_php.php

and include the fields:
products_attributes_weight
products_attributes_weight_prefix

in the select statement so that the information is available per attribute in the tpl_shopping_cart_default.php

Just follow the pattern of the:
options_values_price
price_prefix

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!

1 Sep 2007, 12:00 PM
#15
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Hello just saw this - I am trying your suggestion - thank you so much!

Stay tuned - btw I am very happy with everything in Zen Cart. Its a wicked program and everything up to this point has been a breeze.

I know I can crack this.

Big :D Thx.

1 Sep 2007, 1:01 PM
#16
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

YOU ROCK

I DID IT!!!

I AM VERY HAPPY AND NOW CAN FINISH MY PROJECT

EASY TO CUSTOMIZE

THANK YOU THANK YOU

:clap:

AJEH IS THE BEST !

1 Sep 2007, 2:17 PM
#17
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

You are most welcome ... glad that we could get you back on track ... :smile:

That is tricky code in there, you done good ... :smartalec:

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!

1 Sep 2007, 10:28 PM
#18
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Thank you! One more major thing if I may?

So I have entered all the options for each product and can now see the weights in the shopping cart itself - great!

Of course I want to show the weights in the confirmation page, order history, invoice and order!

They all share the same string on each page:

<li><?php echo $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); ?></li>

Any ideas about what I put in here to show weight? Than I can add to all the above mentioned pages...

Thanks again.

2 Sep 2007, 12:25 AM
#19
ajeh avatar

ajeh

Oba-san

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

Re: How can I show the attribute weight for each item in cart?

This is the section on the Account History tpl_account_history_info_default.php that echos out the display:

    <tr>
        <td class="accountQuantityDisplay"><?php echo  $order->products[$i]['qty'] . QUANTITY_SUFFIX; ?></td>
        <td class="accountProductDisplay"><?php echo  $order->products[$i]['name'];

    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
      echo '<ul id="orderAttribsList">';
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
        echo '<li>' . $order->products[$i]['attributes'][$j]['option'] . TEXT_OPTION_DIVIDER . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</li>';
      }
        echo '</ul>';
    }
?>
        </td>
<?php
    if (sizeof($order->info['tax_groups']) > 1) {
?>
        <td class="accountTaxDisplay"><?php echo zen_display_tax_value($order->products[$i]['tax']) . '%' ?></td>
<?php
    }
?>
        <td class="accountTotalDisplay"><?php echo $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') ?></td>
    </tr>

This is the section of the orders.php class that builds that section ...

      $subindex = 0;
      $attributes_query = "select products_options_id, products_options_values_id, products_options, products_options_values,
                              options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "
                               where orders_id = '" . (int)$order_id . "'
                               and orders_products_id = '" . (int)$orders_products->fields['orders_products_id'] . "'";

      $attributes = $db->Execute($attributes_query);
      if ($attributes->RecordCount()) {
        while (!$attributes->EOF) {
          $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options'],
                                                                   'value' => $attributes->fields['products_options_values'],
                                                                   'prefix' => $attributes->fields['price_prefix'],
                                                                   'price' => $attributes->fields['options_values_price']);

          $subindex++;
          $attributes->MoveNext();
        }
      }

Again you need to load the weight and prefix into the select then add it to the array so it is available in the template ...

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 Sep 2007, 9:36 PM
#20
fay808 avatar

fay808

New Zenner

Join Date:
Aug 2007
Posts:
35
Plugin Contributions:
0

Re: How can I show the attribute weight for each item in cart?

Hi - sorry I was away - now I am back. Great thanks for that - I did it again!!

I achieved the array in the orders.php and now can see the weight in orders history.

However I would like to see the weight in checkout confirmation, email confirmation and the invoice page.

I tried to add the weight but did not work - it won't read the string.

Is there another place I have to add the array for these pages?

Ajeh - thanks again!