/** * get full detail including items */ function getFullDetail($id, $currency = GLOBAL_DEFAULT_CURRENCY) { if (is_numeric($id)) { $basket = $this->detail($id); require_once 'models/ecommerce/ecommerce_basket_content.php'; $Basket_content = new ecommerce_basket_content(); $Basket_content->setCacheable(false); $basket['items'] = $Basket_content->getItems($id); $basket['currency'] = $currency; require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); $Product->setCacheable(false); foreach ($basket['items'] as &$item) { $variety = $Product->getProductVarietyDetail($item['product_variety_id'], $item['price_id'], $currency); $item['product'] = $Product->ProductDetail($variety['product_id']); $node = $Product->findProductInNode($item['product']['id']); $item['product']['variety'] = $variety; $item['product']['node'] = $node[0]; $item['other_data'] = unserialize($item['other_data']); } return $basket; } else { return false; } }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; require_once 'models/ecommerce/ecommerce_product.php'; $Node = new common_node(); $Product = new ecommerce_product(); $product_id = $this->GET['id']; //listing if (is_numeric($product_id)) { $current = $Product->findProductInNode($product_id); $this->tpl->assign('NODE', $Node->detail($current[0]['id'])); foreach ($current as $key => $node_data) { //don't display homepage if ($key > 0) { if ($node_data['publish'] == 0) { $node_data['class'] = "class='disabled'"; } $this->tpl->assign("ITEM", $node_data); $_Onxshop_Request = new Onxshop_Request("component/breadcrumb~id={$node_data['id']}:create_last_link=1~"); $this->tpl->assign('BREADCRUMB', $_Onxshop_Request->getContent()); $this->tpl->parse("content.multiple.item"); } } if (count($current) > 1) { $this->tpl->parse('content.multiple'); } } return true; }
/** * main action */ public function mainAction() { header('Content-Type: text/xml; charset=UTF-8'); require_once 'models/common/common_node.php'; $Node = new common_node(); require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); require_once 'models/ecommerce/ecommerce_product_image.php'; $Image = new ecommerce_product_image(); $products = $Product->getProductList(); //print_r($products);exit; $this->tpl->assign('ITEM_TYPE', 'new'); //new or bazaar $this->tpl->assign('DUES', 0); //poplatky mimo postovneho $this->tpl->assign('DELIVERY_DATE', 1); //doba expedice $this->tpl->assign('TOLLFREE', 0); foreach ($products as $p) { //get product detail URL $current = $Product->findProductInNode($p['id']); $product_node_data = $current[0]; $page_id = $product_node_data['id']; $p['url'] = "http://{$_SERVER['HTTP_HOST']}" . $Node->getSeoURL($page_id); //description $p['description'] = html_entity_decode(strip_tags($p['description']), ENT_QUOTES, 'UTF-8'); //image $images = $Image->listing("role = 'main' AND node_id=" . $p['id'], "priority DESC, id ASC", '0,1'); $this->tpl->assign('IMAGE_PRODUCT', "http://{$_SERVER['HTTP_HOST']}/image/{$images[0]['src']}"); //assign to template $this->tpl->assign('PRODUCT', $p); //variety list if (is_array($p['variety'])) { foreach ($p['variety'] as $v) { //$v['description'] = html_entity_decode(strip_tags($v['description'])); $this->tpl->assign('VARIETY', $v); $this->tpl->assign('PRICE', $v['price']['value']); if ($v['publish'] == 1) { $this->tpl->parse("content.item_product.item_variety"); } } } if ($p['publish'] == 1) { $this->tpl->parse("content.item_product"); } } return true; }
/** * main action */ public function mainAction() { /** * get product detail */ require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); $product = $Product->productDetail($this->GET['product_id']); /** * if product_node_id is empty, than find default */ if (is_numeric($this->GET['product_node_id'])) { $product_node_id = $this->GET['product_node_id']; } else { $product_node_detail = $Product->findProductInNode($this->GET['product_id']); $product_node_id = $product_node_detail['id']; } /** * process only published */ if ($product['publish'] == 1) { $this->tpl->assign('PRODUCT', $product); /** * process images */ $this->processImages($product); /** * varieties */ $Variety_list = new Onxshop_Request("component/ecommerce/variety_list~product_id={$this->GET['product_id']}~"); $this->tpl->assign('VARIETY_LIST', $Variety_list->getContent()); /** * highlight stars (TODO: rating) */ if ($product['priority'] > 99) { $c = $product['priority'] / 100; for ($i = 0; $i < $c; $i++) { $this->tpl->parse("content.highlight.star"); } $this->tpl->assign('HIGHLIGHT_TEXT', " {$i} stars rating"); $this->tpl->parse("content.highlight"); } } return true; }
/** * main action */ public function mainAction() { set_time_limit(0); header('Content-Type: text/xml; charset=UTF-8'); require_once 'models/common/common_node.php'; $Node = new common_node(); require_once 'models/ecommerce/ecommerce_product.php'; require_once 'models/ecommerce/ecommerce_product_image.php'; $Product = new ecommerce_product(); $Image = new ecommerce_product_image(); $products = $Product->getProductList(); //print_r($products);exit; if (is_array($products)) { foreach ($products as $p) { if ($p['publish'] == 1) { $nodes = $Product->findProductInNode($p['id']); $link = $Node->getSeoURL($nodes[0]['id']); $p['link'] = "http://{$_SERVER['HTTP_HOST']}{$link}"; $images = $Image->listing("role = 'main' AND node_id=" . $p['id'], "priority DESC, id ASC"); $p['image_src'] = "http://{$_SERVER['HTTP_HOST']}/image/{$images[0]['src']}"; $this->tpl->assign('PRODUCT', $p); if (is_array($p['variety'])) { foreach ($p['variety'] as $k => $v) { //show only first variety if ($k == 0) { $this->tpl->assign('VARIETY', $v); $this->tpl->assign('PRICE', $v['price']); //set availibity, other possible values are 'available for order' and 'preorder' //if ($v['stock'] > 0) $this->tpl->assign('AVAILIBILITY', 'in stock'); //else $this->tpl->assign('AVAILIBILITY', 'out of stock'); $this->tpl->assign('AVAILIBILITY', 'in stock'); //always on stock, because first variety can be out of stock, but other not, we should do a check if any variety is in stock $this->tpl->parse("content.generated.item"); } } } } } } //save it to the file $this->tpl->parse("content.generated"); file_put_contents(ONXSHOP_PROJECT_DIR . "var/files/googlebase.xml", $this->tpl->text("content.generated")); return true; }
/** * render list */ public function renderList($product_list) { if (is_array($product_list)) { require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); foreach ($product_list as $i => $item) { $current = $Product->findProductInNode($item['product_id']); $product_list[$i]['node_id'] = $current[0]['id']; } /** * Display items */ foreach ($product_list as $item) { $this->tpl->assign('ITEM', $item); $this->tpl->parse('content.item'); } if (count($product_list) == 0) { $this->tpl->parse('content.empty'); } } }