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?
Views: 6,937
New Zenner
Thanks for the code. Works great except it doesn't display Text Attributes.
Anyone know how to modifiy it so text attributes display too?
Zen Follower
Yep, that works on my test site..... wonder why this is not standard code?
Zen Follower
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>';
Zen Follower
Thankyou for this, MASSIVE help with a module I've been developing.
Thankyou
THANKYOU!!!
New Zenner
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.
New Zenner
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.
New Zenner
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 //
New Zenner
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 : myattributesizeHow 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.
New Zenner
Only shows te first attributes, anybody found a solution ?
Tnx.
Macbos
New Zenner
Post number 25 addresses this issue. Just remove the while loop and both attributes are shown correctly.
Fields marked required must be completed.
Tell staff why this post should be reviewed.