/** * main action */ public function mainAction() { set_time_limit(0); require_once 'models/common/common_node.php'; $Node = new common_node(); $sitemap = $Node->getFlatSitemap(); if (is_array($sitemap)) { if ($_SERVER['SSL_PROTOCOL'] || $_SERVER['HTTPS']) { $protocol = 'https'; } else { $protocol = 'http'; } foreach ($sitemap as $node) { $link = $Node->getSeoURL($node['id']); $item['loc'] = "{$protocol}://{$_SERVER['HTTP_HOST']}{$link}"; $item['lastmod'] = $Node->getLastMod($node['id'], $node['modified']); $item['lastmod'] = substr($item['lastmod'], 0, 10); if ($node['parent'] == $Node->conf['id_map-global_navigation'] || $node['parent'] == $Node->conf['id_map-primary_navigation'] || $node['parent'] == $Node->conf['id_map-footer_navigation']) { $item['priority'] = 1; } else { $item['priority'] = 0.5; } $this->tpl->assign("ITEM", $item); $this->tpl->parse("content.item"); } } header('Content-Type: text/xml; charset=UTF-8'); 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() { 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; }
/** * main action */ public function mainAction() { /** * initialize */ require_once 'models/ecommerce/ecommerce_product.php'; require_once 'models/common/common_node.php'; $Node = new common_node(); $Product = new ecommerce_product(); /** * get node detail */ $node_data = $Node->nodeDetail($this->GET['id']); $product_id = $node_data['content']; /** * Check if this is a product homepage */ $product_node_homepage = $Node->getProductNodeHomepage($product_id); if ($node_data['id'] != $product_node_homepage['id']) { //forward to homepage $link = $Node->getSeoURL($product_node_homepage['id']); header("HTTP/1.1 301 Moved Permanently"); header("Location: http://{$_SERVER['SERVER_NAME']}{$link}"); exit; } /** * get simple product detail (just for basic product attributes) */ $simple_product_detail = $Product->detail($product_id); /** * get taxonomy_class */ $related_taxonomy = $Product->getRelatedTaxonomy($product_id); $simple_product_detail['taxonomy_class'] = $this->createTaxonomyClass($related_taxonomy); /** * save product taxonomy_class to registry */ $this->saveBodyCssClass($simple_product_detail['taxonomy_class']); /** * assign simple product data to template */ $this->tpl->assign("PRODUCT", $simple_product_detail); /** * varieties */ //$Variety_list = new Onxshop_Request("component/ecommerce/variety_list_ajax~product_id={$product_id}~"); //$this->tpl->assign('VARIETY_LIST', $Variety_list->getContent()); /** * taxonomy */ $_Onxshop_Request = new Onxshop_Request("component/taxonomy~relation=product:id={$product_id}:hide_root=1~"); $this->tpl->assign('TAXONOMY', $_Onxshop_Request->getContent()); /** * other product attributes */ $_Onxshop_Request = new Onxshop_Request("component/ecommerce/product_other_data~id={$product_id}~"); $this->tpl->assign('OTHER_DATA', $_Onxshop_Request->getContent()); /** * product reviews */ $_Onxshop_Request = new Onxshop_Request("component/ecommerce/product_review~node_id={$product_id}:allow_anonymouse_submit=0~"); $this->tpl->assign('PRODUCT_REVIEW', $_Onxshop_Request->getContent()); /** * standard page actions */ $this->processContainers(); $this->processPage(); if (strlen($simple_product_detail['name_aka']) > 0) { $this->tpl->parse('content.name_aka'); } /** * everything went well */ return true; }
/** * main action */ public function mainAction() { /** * initialize */ require_once 'models/common/common_node.php'; require_once 'models/common/common_image.php'; $Node = new common_node(); $Image = new common_image(); /** * find node id */ if (is_numeric($this->GET['id'])) { $id = $this->GET['id']; } else { $id = $Node->conf['id_map-blog']; } /** * set header */ header('Content-Type: text/xml; charset=UTF-8'); // flash in IE with SSL dont like Cache-Control: no-cache and Pragma: no-coche header("Cache-Control: "); header("Pragma: "); /** * Initialize pagination variables */ if (is_numeric($this->GET['limit_from'])) { $from = $this->GET['limit_from']; } else { $from = 0; } if (is_numeric($this->GET['limit_per_page'])) { $per_page = $this->GET['limit_per_page']; } else { $per_page = 25; } $limit = "{$from},{$per_page}"; /** * latest date */ $rss_date = date('r', time()); $this->tpl->assign("RSS_DATE", $rss_date); /** * check */ if (!is_numeric($id)) { msg('export rss: id is not numeric', 'error'); return false; } /** * process */ $node_data = $Node->getDetail($id); $channel_taxonomy_labels = array(); if ($node_data['publish'] == 1) { $this->tpl->assign('NODE', $node_data); $taxonomy_filter = ''; if (is_numeric($this->GET['taxonomy_tree_id']) && $this->GET['taxonomy_tree_id'] > 0) { $taxonomy_filter = " AND id IN (SELECT node_id FROM common_node_taxonomy WHERE taxonomy_tree_id = {$this->GET['taxonomy_tree_id']})"; } $children = $Node->listing("parent = {$id} AND publish = 1 AND node_group='page' {$taxonomy_filter}", "created DESC", $limit); foreach ($children as $c) { /** * create public link */ $link = $Node->getSeoURL($c['id']); $c['url'] = "http://{$_SERVER['HTTP_HOST']}{$link}"; /** * format date */ $c['rss_date'] = date('r', strtotime($c['created'])); /** * get categories */ $taxonomy_list = $Node->getRelatedTaxonomy($c['id']); foreach ($taxonomy_list as $taxonomy) { $this->tpl->assign('CATEGORY', $taxonomy); $this->tpl->parse('content.item.category'); $channel_taxonomy_labels[$taxonomy['label']['title']] = true; } /** * add image (not part of RSS spec) */ $c['image'] = $this->processImage($Image->getTeaserImageForNodeId($c['id'])); /** * assign */ $this->tpl->assign('CHILD', $c); if ($c['image']) { $this->tpl->parse("content.item.image"); } $this->tpl->parse("content.item"); } } // parse channel category list $i = 0; foreach ($channel_taxonomy_labels as $label => $item) { if ($i + 1 < count($channel_taxonomy_labels)) { $label = $label . "/"; } $this->tpl->assign('CATEGORY', $label); $this->tpl->parse('content.category'); $i++; } return true; }