Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

build an array of products in shopping cart


digisamples

Recommended Posts

Posted

How would you go about building an array of the items in the shopping cart, I only need the model numbers on the items in the shopping cart. I am fairly new to osCommerce and php but am familiar with building arrays using actionscript (flash). What I am planning on doing is storing the mp3 file name in the model space and album art in the image space. Once I am able to get an array of the model number (mp3 files) I will than pass it to a .swf and use those files in a player.

 

Any help or suggestions are more than welcome. Thanks in advance.

  • 1 year later...
Posted

Here is the structure of the $products array: (in this example , we have 2 products in the shopping cart)

 

Array
(
[0] => Array
	(
		[id] => 24
		[name] => Disciples: Sacred Lands
		[model] => PC-DISC
		[image] => gt_interactive/disciples.gif
		[price] => 90.0000
		[quantity] => 1
		[weight] => 8.00
		[final_price] => 90
		[tax_class_id] => 1
		[attributes] => 
	)

[1] => Array
	(
		[id] => 11
		[name] => Fire Down Below
		[model] => DVD-FDBL
		[image] => dvd/fire_down_below.gif
		[price] => 29.9900
		[quantity] => 1
		[weight] => 7.00
		[final_price] => 29.99
		[tax_class_id] => 1
		[attributes] => 
	)

)

 

To test the content of this array in your shopping cart add the following line of code :

print_r($products);

 

just after :

$products = $cart->get_products();

 

in shopping_cart.php

Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent...

Posted

Example:

 

for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$products[$i]['model'] = 'blablabla';
}

Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent...

Archived

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

×
×
  • Create New...