/** * parseStoreSelect */ protected function parseStoreSelect($selected_id) { require_once 'models/ecommerce/ecommerce_store.php'; $Store = new ecommerce_store(); $provinces = $this->getTaxonomyBranch(self::TAXONOMY_TREE_PROVINCE_ID); foreach ($provinces as $province) { $this->tpl->assign("PROVINCE_NAME", $province['label']['title']); $counties = $this->getTaxonomyBranch($province['id']); foreach ($counties as $county) { $county['selected'] = $selected_id == $county['id'] ? 'selected="selected"' : ''; $this->tpl->assign("COUNTY", $county); // get all stores in this count $store_list = $Store->getFilteredStoreList($county['id'], false, 0, false, false, 1000); //limit to 1000 records per county foreach ($store_list as $store_item) { $this->tpl->assign('STORE', $store_item); $this->tpl->parse("content.form.require_user_details.store.county_dropdown.province.store"); } } $this->tpl->parse("content.form.require_user_details.store.county_dropdown.province"); } $this->tpl->parse("content.form.require_user_details.store.county_dropdown"); $this->tpl->parse("content.form.require_user_details.store"); }
/** * parseStoreSelect */ protected function parseStoreSelect($selected_id, $template_block_path = 'content.form') { require_once 'models/ecommerce/ecommerce_store.php'; $Store = new ecommerce_store(); $provinces = $this->getTaxonomyBranch($GLOBALS['onxshop_conf']['global']['province_taxonomy_tree_id']); foreach ($provinces as $province) { $this->tpl->assign("PROVINCE_NAME", $province['label']['title']); $counties = $this->getTaxonomyBranch($province['id']); foreach ($counties as $county) { $county['selected'] = $selected_id == $county['id'] ? 'selected="selected"' : ''; $this->tpl->assign("COUNTY", $county); // get all stores in this count $store_list = $Store->getFilteredStoreList($county['id'], false, 1, false, false, 1000); //limit to 1000 records per county and type_id=1 foreach ($store_list as $store_item) { if ($store_item['publish']) { $this->tpl->assign('STORE', $store_item); $this->tpl->parse("{$template_block_path}.store.county_dropdown.province.store"); } } } $this->tpl->parse("{$template_block_path}.store.county_dropdown.province"); } $this->tpl->parse("{$template_block_path}.store.county_dropdown"); $this->tpl->parse("{$template_block_path}.store"); }
/** * main action */ public function mainAction() { // initialize filter variables $taxonomy_id = $this->GET['taxonomy_tree_id']; if (isset($_POST['store-list-filter'])) { $_SESSION['bo']['store-list-filter'] = $_POST['store-list-filter']; } $keyword = $_SESSION['bo']['store-list-filter']['keyword']; $type_id = $_SESSION['bo']['store-list-filter']['type_id']; // initialize sorting variables if ($this->GET['store-list-sort-by']) { $_SESSION['bo']['store-list-sort-by'] = $this->GET['store-list-sort-by']; } if ($this->GET['store-list-sort-direction']) { $_SESSION['bo']['store-list-sort-direction'] = $this->GET['store-list-sort-direction']; } if ($_SESSION['bo']['store-list-sort-by']) { $order_by = $_SESSION['bo']['store-list-sort-by']; } else { $order_by = 'modified'; } if ($_SESSION['bo']['store-list-sort-direction']) { $order_dir = $_SESSION['bo']['store-list-sort-direction']; } else { $order_dir = 'DESC'; } // 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; } // get the list require_once 'models/ecommerce/ecommerce_store.php'; $Store = new ecommerce_store(); $store_list = $Store->getFilteredStoreList($taxonomy_id, $keyword, $type_id, $order_by, $order_dir, $per_page, $from); $count = $Store->getFilteredStoreCount($taxonomy_id, $keyword, $type_id); if (!is_array($store_list)) { return false; } if (count($store_list) == 0) { $this->tpl->parse('content.empty_list'); return true; } // display pagination $_Onxshop_Request = new Onxshop_Request("component/pagination~link=/request/bo/component/ecommerce/store_list:limit_from={$from}:limit_per_page={$per_page}:count={$count}~"); $this->tpl->assign('PAGINATION', $_Onxshop_Request->getContent()); // parse items foreach ($store_list as $item) { $item['modified'] = date("d/m/Y H:i", strtotime($item['modified'])); $this->tpl->assign('ITEM', $item); if ($item['image_src']) { $this->tpl->parse('content.list.item.image'); } $even_odd = 'odd' != $even_odd ? 'odd' : 'even'; $publish = $item['publish'] ? '' : 'disabled'; $this->tpl->assign('CLASS', "class='{$even_odd} {$publish} fullstore'"); $this->tpl->parse('content.list.item'); } $this->tpl->parse('content.list'); return true; }