If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Managing Customers and Orders / Change item name of a product in the basket.

Change item name of a product in the basket.

Started by aceafty on 30 Oct 2012, 11:39 PM · Views: 970

Results 1 to 4 of 4
30 Oct 2012, 11:39 PM
#1
aceafty avatar

aceafty

New Zenner

Join Date:
Jan 2009
Posts:
3
Plugin Contributions:
0

Post #1 by aceafty

Hi
I want to add a product to the basket but change the product name after i click on add to cart so when the product appears in the cart it will have a different Item name.

From what i understand I have to use observer classes to drop in my code inbetween the process from product page to cart.

I have used the following code but not worked, either i'm using the wrong notifier or assigning the change wrong.

Following code is located in: includes/classes/observers/class.cart_prod_change.php

<?php class cart_prod_change extends base { function __construct() { global $zco_notifier; $zco_notifier->attach($this, array('NOTIFIER_CART_ADD_CART_END')); } function update(&$class, $eventID, $paramsArray = array()) { $bannerdesc = "banners"; $_SESSION['products_name'] = $bannerdesc ; //echo $_SESSION['products_name']; } } ?>

Following code is located in: includes/auto_loaders/config.cart_prod_change.php

<?php $autoLoadConfig[10][] = array('autoType'=>'class', 'loadFile'=>'observers/class.cart_prod_change.php'); $autoLoadConfig[90][] = array('autoType'=>'classInstantiate', 'className'=>'cart_prod_change', 'objectName'=>'cart_prod_change'); ?>

Hope someone can help i can't make heads or tails of this.

31 Oct 2012, 2:29 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #2 by kobra

Why would you want the product name changed???

Zen-Venom Get Bitten

31 Oct 2012, 1:53 PM
#3
aceafty avatar

aceafty

New Zenner

Join Date:
Jan 2009
Posts:
3
Plugin Contributions:
0

Post #3 by aceafty

Hi
Im going to have a page with where a customer enters a height and width of some material it'll calculate a cost and add it to basket. so this product can't be inputted into the database as there are infinite possibilities of size combination. when the product is added to the cart it would contain the size in the product name and the custom price will be added.

A friend of mine has developed the same thing in wordpress with shopp plugin, and this seems to be the easiest way implement this function.

So can anyone help me with this.

1 Nov 2012, 5:39 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Post #4 by gjh42

I have a feeling this is going to run into continuity issues the way you are describing it. A better way might be to create a "dependent attribute" setup where the entered/selected attribute values are multiplied (by javascript) to get the product's current price. This would still require custom coding, but once done it would feed into totally stock handling. There might be unknown repercussions of doing what you originally described; only an expert could say for sure. This mod may do what you want, or at least point the way to it:
http://www.zen-cart.com/downloads.php?do=file&id=618