Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Manufacturers Name to Shopping Cart


saleem145

Recommended Posts

Posted

Hi,

 

When I display the shopping cart I would like to display the manufacturers name of the product as well. I notice that this is not stored in the $cart array. My question is when I add an item to the shopping cart which file modifies what is stored in $cart array. So I can make the appropriate change?? Is this the only file that needs to be edited??

 

Thanks,

 

Saleem

  • 2 months later...
Posted

Anyone have an answer to this? I also want to do the same thing

Posted

/catalog/shopping_cart.php

 

Change the $product_name section to look like this:

 

 ? ? ?$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
? ? ? ? ? ? ? ? ? ? ? ' ?<tr>' .
? ? ? ? ? ? ? ? ? ? ? ' ? ?<td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['manufacturer'] . ' ' . $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
? ? ? ? ? ? ? ? ? ? ? ' ? ?<td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['manufacturer'] . ' ' . $products[$i]['name'] . '</b></a>';

 

 

/catalog/includes/classes/shopping_cart.php

 

Find:

 

 ? ? ? ? ?$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
? ? ? ? ?if (tep_db_num_rows($specials_query)) {
? ? ? ? ? ?$specials = tep_db_fetch_array($specials_query);
? ? ? ? ? ?$products_price = $specials['specials_new_products_price'];
? ? ? ? ?}

 

Add below:

 

 ? ? ? ? ?// Get manufacturers_name for products
? ? ? ? ?$mfr_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS ?. " where manufacturers_id = '" . (int)$products['manufacturers_id'] . "'");
? ? ? ? ?$mfr = tep_db_fetch_array($mfr_query);

 

 

Change the $product_array query below to this:

 

 ? ? ? ? ?$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'] : ''),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'manufacturer' => $mfr['manufacturers_name']);

  • 1 month later...
Posted

Hi Draven,

 

Thanks for that - sorry for the delay in replying...only realised now that you had replied back in August.

 

I've changed the code as you have suggested, but the manufacturer's name is still not showing up in the cart...? Do I need to add anything to the database?

  • 1 year later...

Archived

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

×
×
  • Create New...