Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how to: Put products options in Cart Box


virgule

Recommended Posts

Hi all B)

 

I 've put both name and model of a desired product on the shopping cart info box.

 

Now below that, I'd like to put the chosen options of a product in this box when added to the shopping cart...i tried to sort it out but here is what i obtain:

 

1 x D?licatesse (< name)

[bLUE-LILAC] (< model)

Array (< options) why an array??

---------------------------------

12,00 ? (<price)

 

here is my code (\webspace\includes\boxes\shopping_cart.php):

$cart_contents_string .= $products[$i]['name']. ' <br>[' . $products[$i]['model']. ']<br>' . $products[$i]['attributes'] .'</span></td></tr></a>';

 

Thank you in advance for both your help & time ;)

 

Enjoy

ben

Link to comment
Share on other sites

Array                (< options) why an array??
$products[$i]['attributes'] is (potentially) a list, so it is stored in an array. I've seen products with as many as 15 options. You can find an example traversing the array in checkout_process.php

 

Hth,

Matt

Link to comment
Share on other sites

  • 7 months later...

Good day I am trying to do thids also.... I did as you listed bu t this is what I get in the shopping cart info box

 

USING

 

$cart_contents_string .= $products[$i]['name']. ' <br>[' . $products[$i]['model']. ']<br>' . $products[$i]['attributes'] .'</span></td></tr></a>';

 

YEILDS

 

Deco Slide Mounts

[PPsldmt] Deco Slide Mounts

 

the shopping cart page to the right shows this (which is what I want in the info box for shopping cart)

 

Deco Slide Mounts

- Color Mocha Creme

 

what do I need to change here $products[$i]['attributes'] .' for this color to show up on the left in the box? I tried Option Value in place of attributes but it did not work. Can anyone help?

Link to comment
Share on other sites

I found the code that writes what i want if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

reset($products[$i]['attributes']);

while (list($option, $value) = each($products[$i]['attributes'])) {

$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';

}

}

 

but I do not know how to integrate it into

 

Shopping_cart

 

$cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...