View Single Post
  #1  
Old 06-06-2016, 11:55 AM
 
FactorInteractivo FactorInteractivo is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 44
 

Default How to get a global attribute and handle its value

We are working on a module in X-Cart 5 which according to the value of a global attribute must show an Icon next to a product in the "On sale" products list.

In the route classes/xlite/module/developerID/moduleID/view/price.php we have the following code

Code:
/** * Return sale participation flag * * @return boolean */ protected function participateSale() { return $this->getProduct()->getParticipateSale(); }

and my product TPL is like the following:

Code:
{* vim: set ts=2 sw=2 sts=2 et: *} {** * Product price value * * @author Qualiteam software Ltd <info@x-cart.com> * @copyright Copyright (c) 2011-2015 Qualiteam software Ltd <info@x-cart.com>. All rights reserved * @license http://www.x-cart.com/license-agreement.html X-Cart 5 License Agreement * @link http://www.x-cart.com/ * * @ListChild (list="product.plain_price", weight="10") *} <li IF="participateSale()" class="sale-banner"> <div class="sale-banner-block"> <div class="text">{t(#sale#)}</div> <div class="percent">{t(#percent X off#,_ARRAY_(#percent#^getSalePercent())):h}</div> </div> </li>

At the same time, we have a Global Attribute called "sale" which contains a value of 0 or 1.

I need the function "participateSale" to return "True" if the "sale" attribute value for a product is 1.

My problem is that I don´t know how to access to that attribute from the current folder I´m working.

Any ideas ? Thanks in advance !!

X-Cart 5.2.15
__________________
X-Carting since 2006
Reply With Quote