/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->object = \Category\CategoryApi::getInstance(); /** Test add/update data */ $this->testData = array('tpl' => 'testTPL', 'order_method' => 2, 'showsitetitle' => 1, 'parent_id' => 1, 'url' => random_string(), 'active' => 1, 'image' => 'testImage', 'name' => 'testName', 'h1' => 'testH1', 'description' => 'testDescription', 'meta_desc' => 'testMetaDesc', 'meta_title' => 'testMetaTitle', 'meta_keywords' => 'testMetaKeywords', 'position' => 1, 'external_id' => 11); $this->ci =& get_instance(); /** Get first category from DB */ $this->testCategory = $this->ci->db->limit(1)->get('shop_category'); $this->testCategory = $this->testCategory ? $this->testCategory->row_array() : array(); /** Get first category i18n from DB */ $this->testCategoryI18N = $this->ci->db->limit(1)->get('shop_category_i18n'); $this->testCategoryI18N = $this->testCategoryI18N ? $this->testCategoryI18N->row_array() : array(); /** Get categories count from DB */ $this->testCategoriesCount = $this->ci->db->get('shop_category'); $this->testCategoriesCount = $this->testCategoriesCount ? $this->testCategoriesCount->num_rows() : 0; }
/** * Generates an array of data to create a body xml */ public function index() { $ci = ShopCore::$ci; $this->settings = $this->ymarket_model->init(); $this->currencyCode = ShopCore::app()->SCurrencyHelper->current->code; $categories = \Category\CategoryApi::getInstance()->getCategory($this->settings['unserCats']); /* @var $p SProducts */ foreach ($this->ymarket_model->getProducts($this->settings['unserCats']) as $p) { $param = ShopCore::app()->SPropertiesRenderer->renderPropertiesArray($p); $additionalImages = $this->getAdditionalImages($p); /* @var $v SProductVariants */ foreach ($p->getProductVariants() as $v) { if (!$v->getPrice()) { continue; } $unique_id += $p->getId() . '.' . $v->getId(); $this->offers[$unique_id]['url'] = $ci->config->item('base_url') . '/shop/product/' . $p->url; $this->offers[$unique_id]['price'] = $v->getPrice(); $this->offers[$unique_id]['currencyId'] = $this->currencyCode; $this->offers[$unique_id]['categoryId'] = $p->getCategoryId(); $this->offers[$unique_id]['picture'] = array_merge(array(productImageUrl('products/main/' . $v->getMainImage())), $additionalImages); $this->offers[$unique_id]['name'] = $this->forName($p->getName(), $v->getName()); $this->offers[$unique_id]['vendor'] = $p->getBrand() ? htmlspecialchars($p->getBrand()->getName()) : ''; $this->offers[$unique_id]['vendorCode'] = $v->getNumber() ? $v->getNumber() : ''; $this->offers[$unique_id]['description'] = htmlspecialchars($p->getFullDescription()); if ($this->settings['adult']) { $this->offers[$unique_id]['adult'] = 'true'; } $this->offers[$unique_id]['param'] = $param; } } $infoXml['categories'] = $categories; $infoXml['offers'] = $this->offers; $infoXml['site_short_title'] = $this->settings['site_short_title']; $infoXml['site_title'] = $this->settings['site_title']; $infoXml['base_url'] = $ci->config->item('base_url'); $infoXml['imagecms_number'] = IMAGECMS_NUMBER; $infoXml['siteinfo_adminemail'] = siteinfo('siteinfo_adminemail'); $infoXml['currencyCode'] = $this->currencyCode; \CMSFactory\assetManager::create()->setData('infoXml', $infoXml)->render('main', true); exit; }
echo $THEME; } ?> images/select-picture.png" class="img-polaroid " style="width: 40px; "> </div> </div> </div> <div class="input-text-in"> <input name="name" type="text"/> </div> </div> </td> <td> <select name="catId"> <?php $result = \Category\CategoryApi::getInstance()->getTree(); if (is_true_array($result)) { foreach ($result as $cat) { ?> <option value="<?php echo $cat->getId(); ?> "><?php echo str_repeat("-", $cat->getLevel()); ?> <?php echo $cat->getName(); ?> </option> <?php }