/** * main action */ public function mainAction() { require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); $product_detail = $Product->getDetail($this->GET['id']); if (is_array($product_detail['other_data'])) { foreach ($product_detail['other_data'] as $key => $value) { //format key $key = preg_replace("/required_/", "", $key); $key = preg_replace("/_/", " ", $key); $key = ucfirst($key); //prepare array for template $note['key'] = $key; $note['value'] = $value; //assign to template if (trim($note['value']) != '') { $this->tpl->assign('OTHER_DATA', $note); $this->tpl->parse('content.other_data.item'); $show_other_data = 1; } } //display if (count($product_detail['other_data']) > 0) { $this->tpl->parse('content.other_data'); } } return true; }
/** * checkForFreePromoItem */ public function checkForFreePromoItem($promotion_data, $order_value) { if (is_array($promotion_data)) { $product_variety_id = $promotion_data['free_promo_products'][9999]; if (is_numeric($promotion_data['free_promo_products'][9999])) { require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); $variety = $Product->getProductVarietyDetail($product_variety_id); if ($variety) { $variety['product'] = $Product->getDetail($variety['product_id']); return $variety; } } } return false; }