Darklings Posted March 29, 2006 Posted March 29, 2006 Hi, Can anyone explain to me where classes/shopping_cart.php gets his content for: $products['products_name'] I want to add extra info to my shopping_cart to display in the Shopping cart! for ex.: $products['qty_blocks'] . Don't worry about the content ... its already added in the database on creation of the product! When a product is added to the shop he puts a value in table: PRODUCTS: products_qty_blocks Inside my classes/shopping_cart.php i'v added this: echo '<pre><span style="font-size: 12px; ">'; echo '<br> products array :'; print_r($products_array); echo '</pre>' Witch gives me this: products array :Array ( [0] => Array ( [id] => 169 [name] => Cheers VIII [model] => [image] => DKL332.jpg [category] => 21 [price] => 48.0000 [qty_blocks] => [quantity] => 110 [weight] => 0.00 [final_price] => 48 [tax_class_id] => 5 [attributes] => ) [1] => Array ( [id] => 120 [name] => 23.743.9 [model] => [image] => 23_743_9.jpg [category] => 2 [price] => 0.35 [qty_blocks] => [quantity] => 1 [weight] => 0.00 [final_price] => 0.35 [tax_class_id] => 5 [attributes] => ) [2] => Array ( [id] => 132 [name] => Nathan BK [model] => [image] => Nathan-BK.jpg [category] => 22 [price] => 0.0690 [qty_blocks] => [quantity] => 300 [weight] => 0.00 [final_price] => 0.069 [tax_class_id] => 5 [attributes] => ) ) Here you can see i already added a: 'qty_blocks' => $products['qty_blocks'], between the other $products like for ex.: 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], Now i need to know where he gets the right content, and puts the right name, model, image etc... So i can add into that querie most likeley, a new one, to add content from the db (products_qty_blocks) so he remembers that too in the shoppingcart. Thnx in advance. Kind Regards, Tom Even in this dark place, yes, I am afraid of my own shadow. Contributions | KnowledgeBase | osCommerce 2.2 pdf
boxtel Posted March 29, 2006 Posted March 29, 2006 Hi, Can anyone explain to me where classes/shopping_cart.php gets his content for: $products['products_name'] I want to add extra info to my shopping_cart to display in the Shopping cart! for ex.: $products['qty_blocks'] . Don't worry about the content ... its already added in the database on creation of the product! When a product is added to the shop he puts a value in table: PRODUCTS: products_qty_blocks Inside my classes/shopping_cart.php i'v added this: echo '<pre><span style="font-size: 12px; ">'; echo '<br> products array :'; print_r($products_array); echo '</pre>' Witch gives me this: products array :Array ( [0] => Array ( [id] => 169 [name] => Cheers VIII [model] => [image] => DKL332.jpg [category] => 21 [price] => 48.0000 [qty_blocks] => [quantity] => 110 [weight] => 0.00 [final_price] => 48 [tax_class_id] => 5 [attributes] => ) [1] => Array ( [id] => 120 [name] => 23.743.9 [model] => [image] => 23_743_9.jpg [category] => 2 [price] => 0.35 [qty_blocks] => [quantity] => 1 [weight] => 0.00 [final_price] => 0.35 [tax_class_id] => 5 [attributes] => ) [2] => Array ( [id] => 132 [name] => Nathan BK [model] => [image] => Nathan-BK.jpg [category] => 22 [price] => 0.0690 [qty_blocks] => [quantity] => 300 [weight] => 0.00 [final_price] => 0.069 [tax_class_id] => 5 [attributes] => ) ) Here you can see i already added a: 'qty_blocks' => $products['qty_blocks'], between the other $products like for ex.: 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], Now i need to know where he gets the right content, and puts the right name, model, image etc... So i can add into that querie most likeley, a new one, to add content from the db (products_qty_blocks) so he remembers that too in the shoppingcart. Thnx in advance. Kind Regards, Tom the shopping cart does not hold any name fields, only the product id and quantity. when the order object requests the cart contents from the cart object, then the related information is retrieved from the database by the get_products() method of the cart class. Treasurer MFC
Darklings Posted March 29, 2006 Author Posted March 29, 2006 Thnx boxtel, So i asume it would be better to just make a new querie asking for the products_qty_blocks info? Instead of searching my way to the original query where the shoppingcart gets his info from... cause i'm not finding it... How come they made this shopping_cart so complicated???? :s Even in this dark place, yes, I am afraid of my own shadow. Contributions | KnowledgeBase | osCommerce 2.2 pdf
boxtel Posted March 29, 2006 Posted March 29, 2006 Thnx boxtel, So i asume it would be better to just make a new querie asking for the products_qty_blocks info? Instead of searching my way to the original query where the shoppingcart gets his info from... cause i'm not finding it... How come they made this shopping_cart so complicated???? :s pretty easy with a simple query per product in the cart in function get_products() in the class: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); and subsequently returning an array holding the products with their additional info: $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '')); Treasurer MFC
Recommended Posts
Archived
This topic is now archived and is closed to further replies.