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.