Forums / Setting Up Categories, Products, Attributes / Can I show the Model number in the cart?

Can I show the Model number in the cart?

Locked

Views: 7,775

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
5 Dec 2006, 2:15 AM
#1
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Can I show the Model number in the cart?

Hi,

I've put my product SKU in the model number field. (My products don't have model numbers, and I need the SKU.) It shows on the product page but doesn't show in the shopping cart or on the order form.

Is there maybe a setting to turn it on in the cart and the order form? If not, has anyone created custom code to do this and would be willing to share the solution?

Thanks in advance.

Rob

Breakfast: the most important donut of the day.

5 Dec 2006, 2:41 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I show the Model number in the cart?

The easiest way would be to use the function:

zen_products_lookup($product_id, $what_field = 'products_name', $language = '')

Pass it the $product['id'] and 'products_model' ... the language will be assumed to be the current language ...

Example:

<?php echo zen_products_lookup($product['id'], 'products_model'); ?>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Dec 2006, 3:41 PM
#3
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Can I show the Model number in the cart?

Thanks Linda,

From a post of last June, referring to pre-1.3.6 Zen cart, I think I got the right page to do that: includes/templates/template_default/templates/tpl_shopping_cart_default.php

Is that right?

On that page, in the foreach ($productArray as $product) section, there are a number of TDs. Would I put that code in the cartProductDisplay TD? Or can I safely add an additional TD to the cart table? That might work best for me, since I'd prefer the model number to show first in each line in the cart.

(You can probably tell I'm not much good with PHP -- yet.)

TIA

Rob

Breakfast: the most important donut of the day.

5 Dec 2006, 3:44 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I show the Model number in the cart?

In v1.3.6, somewhere around line 85:

<a href="<?php echo $product['linkProductsName']; ?>"><div id="cartImage" class="back"><?php echo $product['productsImage']; ?></div><div id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></div></a>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Dec 2006, 3:53 PM
#5
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Can I show the Model number in the cart?

Yup, that's the section I was looking at. I'll give it a try later this evening and get back if I have any problems.

Thanks again

Rob

Breakfast: the most important donut of the day.

6 Dec 2006, 9:26 PM
#6
rstevenson avatar

rstevenson

Totally Zenned

Join Date:
Nov 2006
Location:
Dartmouth, NS Canada
Posts:
2,400
Plugin Contributions:
0

Re: Can I show the Model number in the cart?

That worked of course.

Thanks Linda.

Breakfast: the most important donut of the day.

26 Apr 2007, 5:25 AM
#7
tj1 avatar

tj1

Totally Zenned

Join Date:
Mar 2005
Location:
California
Posts:
628
Plugin Contributions:
0

Re: Can I show the Model number in the cart?

Hi, I also need to display the model number in the cart.

I'm using ZC 1.3.7; unfortunately I really don't know any php so I don't know how to implement the code mentioned here.

Could someone please explain in simple terms what needs to be replaced with what?

Thanks.

11 Sep 2009, 4:35 PM
#8
je2009 avatar

je2009

New Zenner

Join Date:
Jul 2009
Location:
Maryland
Posts:
65
Plugin Contributions:
0

Re: Can I show the Model number in the cart?

Ajeh:

The easiest way would be to use the function:

zen_products_lookup($product_id, $what_field = 'products_name', $language = '')

> 
> Pass it the $product['id'] and 'products_model' ... the language will be assumed to be the current language ...
> 
> Example:
> ```php
<?php echo zen_products_lookup($product['id'], 'products_model'); ?>

Hi Linda,

Not much of a php programmer. Can you telll me exactly where and what file(s) would I put the code you metioned above?

Just like the original post, I want to add model number to cart page and invoices.

Thanks,

JE

13 Sep 2009, 3:50 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I show the Model number in the cart?

Let's say you want to see the products_model next to the products_name on the shopping cart ...

The original code is in the;
/includes/templates/template_default/templates/tpl_shopping_cart_default.php

this you would copy to your templates and overrides directory:
/includes/templates/your_template_dir/templates/tpl_shopping_cart_default.php

then locate the code:

<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

And change that to read:

<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . ' ' . zen_products_lookup($product['id'], 'products_model') . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

14 Sep 2009, 4:31 AM
#10
je2009 avatar

je2009

New Zenner

Join Date:
Jul 2009
Location:
Maryland
Posts:
65
Plugin Contributions:
0

Re: Can I show the Model number in the cart?

Ajeh:

Let's say you want to see the products_model next to the products_name on the shopping cart ...

The original code is in the;
/includes/templates/template_default/templates/tpl_shopping_cart_default.php

this you would copy to your templates and overrides directory:
/includes/templates/your_template_dir/templates/tpl_shopping_cart_default.php

then locate the code:

<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

> 
> And change that to read:
> ```
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . ' ' . zen_products_lookup($product['id'], 'products_model') . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

Thanks!

One more thing if I may? how to I add another row to the table so has headings of(Qty, Model Number Item Name, Unit, Total)

Also want the model number to populate under the model number heading.

Thanks you're great help!:smile:

14 Sep 2009, 2:36 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Can I show the Model number in the cart?

You would need to re-do the template to allow for another column and then put the model number in its own column ...

I find it easier to just add a <br /> in front of the Model number:

<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<br />' . zen_products_lookup($product['id'], 'products_model') . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

Or add the text for "Model" next to that:

<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<br />' . TABLE_HEADING_MODEL . ': ' . zen_products_lookup($product['id'], 'products_model') . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!