Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Show attributes in shopping cart sidebox?

Show attributes in shopping cart sidebox?

Views: 6,937

Results 21 to 30 of 30
9 Dec 2008, 11:19 AM
#21
mattyzee avatar

mattyzee

New Zenner

Join Date:
Dec 2008
Posts:
7
Plugin Contributions:
0

Show attributes in shopping cart sidebox?

Thanks for the code. Works great except it doesn't display Text Attributes.

Anyone know how to modifiy it so text attributes display too?

18 Jan 2009, 12:20 PM
#22
remoteone avatar

remoteone

Zen Follower

Join Date:
Jan 2009
Location:
Macclesfield, South Australia
Posts:
104
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

Yep, that works on my test site..... wonder why this is not standard code?

18 Jan 2009, 12:42 PM
#23
remoteone avatar

remoteone

Zen Follower

Join Date:
Jan 2009
Location:
Macclesfield, South Australia
Posts:
104
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

And, to put a line space between each item in the shopping cart sidebox:
$content .= '<ul><div style="font-size:75%;">   ' . "-" . $attributes->fields['products_options_values_name'] . '</div></ul><br/>';
instead of
$content .= '<ul><div style="font-size:75%;">   ' . "-" . $attributes->fields['products_options_values_name'] . '</div></ul>';

1 Jul 2009, 12:55 PM
#24
thomasharding avatar

thomasharding

Zen Follower

Join Date:
Sep 2007
Location:
Manchester, England
Posts:
168
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

Thankyou for this, MASSIVE help with a module I've been developing.

Thankyou

THANKYOU!!!

14 Oct 2009, 2:33 PM
#25
finnserver avatar

finnserver

New Zenner

Join Date:
Feb 2005
Posts:
5
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

I'd like also thank you !

if a product have different ie. color AND qty attributes/options,
I was problem to display the first attribute.
Only the qty was displayed.

After playing some hours with the code, I found the solution from php site:

foreach ($products[$i]['attributes'] as $option => $value) {
and
while (list($option, $value) = each($products[$i]['attributes'])) {
are functionally identical.

so I commented out the //while - loop and now all attributes and their values are displayed correctly!

I am not php guru, so maybe someone could confirm that this is correctly fixed.

https://www.vmtarvike.com

30 Jul 2010, 2:32 AM
#26
jmacdoug avatar

jmacdoug

New Zenner

Join Date:
Jun 2007
Location:
NJ
Posts:
84
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

Is there a way to add products to a "temporary basket" sidebox and also show editable attributes in that basket that can be changed up until the user hits a button in that sidebox called add-to-cart. I guess it would be a sort of pseudo cart that must be confirmed by the user then they send it to the cart.

19 Jul 2011, 2:42 PM
#27
tinamohd avatar

tinamohd

New Zenner

Join Date:
Jun 2011
Posts:
9
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

I inserted the following code in tpl_shopping_cart.php as suggested in this thread. I managed to display in my shopping cart sidebox as follows:

1ea - myproductname
Model : mymodelnumber
Colour : ?????
Size : myattributesize

How do I get the colour attribute to be displayed as well? Can someone help me with this?

// BOF Display Attributes //

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
foreach ($products[$i]['attributes'] as $option => $value) {
while (list($option, $value) = each($products[$i]['attributes'])) {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix
from " . TABLE_PRODUCTS_OPTIONS . " popt,
" . TABLE_PRODUCTS_OPTIONS_VALUES . " poval,
" . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . (int)$products[$i]['id'] . "'
and pa.options_id = '" . (int)$option . "'
and pa.options_id = popt.products_options_id
and pa.options_values_id = '" . (int)$value . "'
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'
and poval.language_id = '" . (int)$_SESSION['languages_id'] . "'";

      $attributes = $db->Execute($attributes_query);

$content .= '<ul><div style="font-size: 12px; margin-left: -15px; color: #9f1c00;">' . 'Model : ' .$products[$i]['model'] .'<br>'. 'Colour : ' .'<br>'.'Size : ' .$attributes->fields['products_options_values_name'] . '</div></ul><br>';
}
}
}
// EOF Display Attributes //

11 Feb 2012, 6:33 PM
#28
r0b99 avatar

r0b99

New Zenner

Join Date:
Jan 2012
Posts:
1
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

tinamohd:

I inserted the following code in tpl_shopping_cart.php as suggested in this thread. I managed to display in my shopping cart sidebox as follows:

1ea - myproductname
Model : mymodelnumber
Colour : ?????
Size : myattributesize

How do I get the colour attribute to be displayed as well? Can someone help me with this?

// BOF Display Attributes //

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
foreach ($products[$i]['attributes'] as $option => $value) {
while (list($option, $value) = each($products[$i]['attributes'])) {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix
from " . TABLE_PRODUCTS_OPTIONS . " popt,
" . TABLE_PRODUCTS_OPTIONS_VALUES . " poval,
" . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . (int)$products[$i]['id'] . "'
and pa.options_id = '" . (int)$option . "'
and pa.options_id = popt.products_options_id
and pa.options_values_id = '" . (int)$value . "'
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'
and poval.language_id = '" . (int)$_SESSION['languages_id'] . "'";

      $attributes = $db->Execute($attributes_query);

$content .= '<ul><div style="font-size: 12px; margin-left: -15px; color: #9f1c00;">' . 'Model : ' .$products[$i]['model'] .'<br>'. 'Colour : ' .'<br>'.'Size : ' .$attributes->fields['products_options_values_name'] . '</div></ul><br>';
}
}
}
// EOF Display Attributes //

I know that reviving old threads is bad. But I cannot seem to get more than 1 attribute showing at a time. For some reason it wont show the other one. It shows the size of a product but not the color.

9 Oct 2013, 2:33 PM
#29
macbos avatar

macbos

New Zenner

Join Date:
Jul 2006
Location:
Holland
Posts:
27
Plugin Contributions:
0

Re: Show attributes in shopping cart sidebox?

Only shows te first attributes, anybody found a solution ?

Tnx.

Macbos

21 Dec 2014, 2:48 AM
#30
fbroz avatar

fbroz

New Zenner

Join Date:
Mar 2008
Posts:
35
Plugin Contributions:
1

Re: Show attributes in shopping cart sidebox?

Post number 25 addresses this issue. Just remove the while loop and both attributes are shown correctly.