当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::getCategories方法代码示例

本文整理汇总了PHP中Category::getCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getCategories方法的具体用法?PHP Category::getCategories怎么用?PHP Category::getCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Category的用法示例。


在下文中一共展示了Category::getCategories方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

 function getContent()
 {
     $is_one_dot_five = version_compare(_PS_VERSION_, '1.5', '>');
     // Load prestashop ebay's configuration
     $configs = Configuration::getMultiple(array('EBAY_CATEGORY_LOADED_' . $this->ebay_profile->ebay_site_id, 'EBAY_SECURITY_TOKEN'));
     // Check if the module is configured
     if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) {
         return $this->display('error_paypal_email.tpl', array('error_form_category', 'true'));
     }
     // Load categories only if necessary
     if (EbayCategoryConfiguration::getTotalCategoryConfigurations($this->ebay_profile->id) && Tools::getValue('section') != 'category') {
         $template_vars = array('isOneDotFive' => $is_one_dot_five, 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'token' => Tools::getValue('token'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'form_categories' => EbaySynchronizer::getNbSynchronizableEbayCategorie($this->ebay_profile->id));
         return $this->display('pre_form_categories.tpl', $template_vars);
     }
     // Display eBay Categories
     $ebay_site_id = $this->ebay_profile->ebay_site_id;
     if (!isset($configs['EBAY_CATEGORY_LOADED_' . $ebay_site_id]) || !$configs['EBAY_CATEGORY_LOADED_' . $ebay_site_id] || !EbayCategory::areCategoryLoaded($ebay_site_id)) {
         $ebay_request = new EbayRequest();
         EbayCategory::insertCategories($ebay_site_id, $ebay_request->getCategories(), $ebay_request->getCategoriesSkuCompliancy());
         Configuration::updateValue('EBAY_CATEGORY_LOADED_' . $ebay_site_id, 1);
     }
     // Smarty
     $template_vars = array('alerts' => $this->_getAlertCategories(), 'tabHelp' => '&id_tab=7', 'id_lang' => $this->context->cookie->id_lang, 'id_ebay_profile' => $this->ebay_profile->id, '_path' => $this->path, 'configs' => $configs, '_module_dir_' => _MODULE_DIR_, 'isOneDotFive' => $is_one_dot_five, 'request_uri' => $_SERVER['REQUEST_URI'], 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'token' => Tools::getValue('token'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'date' => pSQL(date('Ymdhis')), 'form_categories' => EbaySynchronizer::getNbSynchronizableEbayCategorie($this->ebay_profile->id), 'nb_categorie' => count(Category::getCategories($this->context->cookie->id_lang, true, false)));
     return $this->display('form_categories.tpl', $template_vars);
 }
开发者ID:kevindesousa,项目名称:ebay,代码行数:25,代码来源:EbayFormCategoryTab.php

示例2: reorderpositions

function reorderpositions()
{
    $cat = Category::getCategories(1, false, false);
    foreach ($cat as $i => $categ) {
        Product::cleanPositions(intval($categ['id_category']));
    }
}
开发者ID:sealence,项目名称:local,代码行数:7,代码来源:reorderpositions.php

示例3: indexAction

 public function indexAction()
 {
     $modelCategory = new Category();
     $order = 'path ASC';
     $categories = $modelCategory->getCategories(null, $order, null);
     $this->view->categories = $categories;
 }
开发者ID:veaglefly,项目名称:BlogCodes,代码行数:7,代码来源:CategoryController.php

示例4: listCategories

 public function listCategories()
 {
     $db = new Category($this->_config);
     $result = $db->getCategories();
     $encodedResult = $this->utf8_converter($result);
     $categories = json_encode($encodedResult);
     echo $categories;
 }
开发者ID:camelcasetechsd,项目名称:training-careers,代码行数:8,代码来源:Main.php

示例5: displayAllMainPageCategoryItems

function displayAllMainPageCategoryItems()
{
    $category_ids = DBHelper::verticalSlice(Category::getCategories(), "id");
    $html = "";
    for ($i = 0; $i < count($category_ids); $i++) {
        $html .= sprintf('<div data-tab="%d" class="category-items hidden">', $i + 1);
        $html .= displayMainPageCategoryItems($category_ids[$i]);
        $html .= '</div>';
    }
    return $html;
}
开发者ID:soengle,项目名称:BringIt,代码行数:11,代码来源:phpToHTML.php

示例6: init

 public function init()
 {
     $this->setMethod('post');
     $title = $this->createElement('text', 'title');
     $title->setLabel('标题:');
     $title->setRequired(TRUE);
     $title->addValidator('stringLength', false, array(4, 100));
     $title->addErrorMessage('标题应有2-50个汉字。');
     $this->addElement($title);
     // 分类
     $category = $this->createElement('select', 'cid');
     $category->setLabel('分类:');
     $category->setRequired(TRUE);
     $modelCategory = new Category();
     $where = array('fid' => 2);
     $categories = $modelCategory->getCategories($where);
     if ($categories != null) {
         foreach ($categories as $value) {
             $category->addMultiOption($value->id, $value->name);
         }
     }
     $this->addElement($category);
     // 博客内容
     $body = $this->createElement('textarea', 'body');
     $body->setLabel('内容:');
     $body->setAttribs(array('rows' => 30, 'cols' => 250));
     $body->setRequired(TRUE);
     $this->addElement($body);
     // tags标签
     $tags = $this->createElement('text', 'tags');
     $tags->setLabel('tags');
     $this->addElement($tags);
     // 发布状态
     $status = $this->createElement('checkbox', 'status');
     $status->setLabel('发布:');
     $status->setValue(1);
     $this->addElement($status);
     // 评论
     $allow = $this->createElement('checkbox', 'comment');
     $allow->setLabel('允许评论:');
     $allow->setValue(1);
     $this->addElement($allow);
     // 提交按钮
     $submit = $this->createElement('submit', '提交');
     $this->addElement($submit);
     // 表单装饰器
     $this->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'sheet')), 'Form'));
 }
开发者ID:veaglefly,项目名称:BlogCodes,代码行数:49,代码来源:Article.php

示例7: getContent

 function getContent()
 {
     $configs = Configuration::getMultiple(array('EBAY_CATEGORY_LOADED_' . $this->ebay_profile->ebay_site_id, 'EBAY_SECURITY_TOKEN'));
     $ebay_request = new EbayRequest();
     $user_profile = $ebay_request->getUserProfile($this->ebay_profile->ebay_user_identifier);
     $store_categories = EbayStoreCategory::getStoreCategories($this->ebay_profile->id);
     $not_compatible_names = array();
     if ($store_categories['not_compatible']) {
         foreach ($store_categories['not_compatible'] as $cat) {
             $not_compatible_names[] = $cat['name'];
         }
     }
     $template_vars = array('configs' => $configs, '_path' => $this->path, 'controller' => Tools::getValue('controller'), 'configure' => Tools::getValue('configure'), 'token' => Tools::getValue('token'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'tab' => Tools::getValue('tab'), 'nb_categorie' => count(Category::getCategories($this->context->cookie->id_lang, true, false)), 'has_store_categories' => count($store_categories['compatible']) > 1, 'not_compatible_store_categories' => implode(', ', $not_compatible_names), 'has_ebay_shop' => (bool) ($user_profile && $user_profile['StoreUrl']), 'ebay_store_url' => EbayCountrySpec::getProUrlBySiteId($this->ebay_profile->ebay_site_id));
     return $this->display('form_store_categories.tpl', $template_vars);
 }
开发者ID:anantha89,项目名称:gpprestashop,代码行数:15,代码来源:EbayFormStoreCategoryTab.php

示例8: __construct

 public function __construct($id, $module = null)
 {
     // var_dump($this->route);
     parent::__construct($id, $module);
     //var_dump();
     if (Yii::app()->params['installed'] === "yes") {
         $this->settings = (require Yii::getPathOfAlias('application.config.settings') . '.php');
         $this->banners = (include_once Yii::getPathOfAlias('application.config.banners') . '.php');
         //$this->categories = $this->getCategories();
         Yii::app()->params['categories'] = Category::getCategories();
     } elseif (Yii::app()->getRequest()->getPathInfo() !== "site/install") {
         $this->redirect(Yii::app()->baseUrl . '/site/install');
     }
     $this->meta = Yii::app()->params['meta'];
     $this->meta['vars']['site_name'] = Yii::app()->name;
 }
开发者ID:kosenka,项目名称:yboard,代码行数:16,代码来源:Controller.php

示例9: reorderpositions

function reorderpositions()
{
    /* Clean products positions */
    if ($cat = Category::getCategories(1, false, false)) {
        foreach ($cat as $i => $categ) {
            Product::cleanPositions((int) $categ['id_category']);
        }
    }
    //clean Category position and delete old position system
    Language::loadLanguages();
    $language = Language::getLanguages();
    $cat_parent = Db::getInstance()->ExecuteS('SELECT DISTINCT c.id_parent FROM `' . _DB_PREFIX_ . 'category` c WHERE id_category != 1');
    foreach ($cat_parent as $parent) {
        $result = Db::getInstance()->ExecuteS('
							SELECT DISTINCT c.*, cl.*
							FROM `' . _DB_PREFIX_ . 'category` c 
							LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = ' . (int) Configuration::get('PS_LANG_DEFAULT') . ')
							WHERE c.id_parent = ' . (int) $parent['id_parent'] . '
							ORDER BY name ASC');
        foreach ($result as $i => $categ) {
            Db::getInstance()->Execute('
			UPDATE `' . _DB_PREFIX_ . 'category`
			SET `position` = ' . (int) $i . '
			WHERE `id_parent` = ' . (int) $categ['id_parent'] . '
			AND `id_category` = ' . (int) $categ['id_category']);
        }
        $result = Db::getInstance()->ExecuteS('
							SELECT DISTINCT c.*, cl.*
							FROM `' . _DB_PREFIX_ . 'category` c 
							LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category`)
							WHERE c.id_parent = ' . (int) $parent['id_parent'] . '
							ORDER BY name ASC');
        // Remove number from category name
        foreach ($result as $i => $categ) {
            Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'category` c 
			LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category`)
			SET `name` = \'' . preg_replace('/^[0-9]+\\./', '', $categ['name']) . '\' 
			WHERE c.id_category = ' . (int) $categ['id_category'] . ' AND id_lang = \'' . (int) $categ['id_lang'] . '\'');
        }
    }
    /* Clean CMS positions */
    if ($cms_cat = CMSCategory::getCategories(1, false, false)) {
        foreach ($cms_cat as $i => $categ) {
            CMS::cleanPositions((int) $categ['id_cms_category']);
        }
    }
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:47,代码来源:reorderpositions.php

示例10: run

 /**
  * Function to scan all the sub directories in the
  * challenges directory and store them in application
  * settings
  */
 public static function run()
 {
     $categoryObj = new Category();
     $categories = $categoryObj->getCategories();
     $categoryLessons = array();
     //Contains all categories and corresponding lessons
     foreach ($categories as $category) {
         $categoryLessons[$category] = array();
     }
     $subDirectories = glob(LESSON_PATH . '*', GLOB_ONLYDIR);
     foreach ($subDirectories as $lessonDir) {
         $className = "\\webgoat\\" . basename($lessonDir);
         if (!class_exists($className)) {
             throw new ClassNotFoundException("No class {$className} exists. Please run loadClasses() first.");
         }
         $obj = new $className();
         $classNameWithoutNamespace = basename($lessonDir);
         //array key contains categories, value contains lessons belonging to that category
         array_push($categoryLessons[$obj->getCategory()], array($classNameWithoutNamespace, $obj));
     }
     \jf::SaveGeneralSetting('categoryLessons', $categoryLessons);
 }
开发者ID:michalkoczwara,项目名称:WebGoatPHP,代码行数:27,代码来源:scanner.php

示例11: hookAdminStatsModules


//.........这里部分代码省略.........
							<td>' . (int) $sale['product_quantity'] . '</td>
							<td>' . Tools::displayprice($sale['total'], $currency) . '</td>
						</tr>';
                }
                $this->html .= '
						</tbody>
					</table>
				</div>';
                $cross_selling = $this->getCrossSales($id_product, $this->context->language->id);
                if (count($cross_selling)) {
                    $this->html .= '
					<h4>' . $this->l('Cross selling') . '</h4>
					<div style="overflow-y: scroll; height: 200px;">
						<h4>' . $this->l('Cross selling') . '</h4>
						<table class="table">
							<thead>
								<tr>
									<th>
										<span class="title_box  active">' . $this->l('Product name') . '</span>
									</th>
									<th>
										<span class="title_box  active">' . $this->l('Quantity sold') . '</span>
									</th>
									<th>
										<span class="title_box  active">' . $this->l('Average price') . '</span>
									</th>
								</tr>
							</thead>
						<tbody>';
                    $token_products = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) $this->context->employee->id);
                    foreach ($cross_selling as $selling) {
                        $this->html .= '
							<tr>
								<td ><a href="?tab=AdminProducts&id_product=' . (int) $selling['id_product'] . '&addproduct&token=' . $token_products . '">' . $selling['pname'] . '</a></td>
								<td align="center">' . (int) $selling['pqty'] . '</td>
								<td align="right">' . Tools::displayprice($selling['pprice'], $currency) . '</td>
							</tr>';
                    }
                    $this->html .= '
							</tbody>
						</table>
					</div>';
                }
            }
        } else {
            $categories = Category::getCategories((int) $this->context->language->id, true, false);
            $this->html .= '
			<form action="" method="post" id="categoriesForm" class="form-horizontal">
				<div class="row row-margin-bottom">
					<label class="control-label col-lg-3" for="id_category">
						<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="' . $this->l('Click on a product to access its statistics!') . '">
							' . $this->l('Choose a category') . '
						</span>
					</label>
					<div class="col-lg-3">
						<select name="id_category" onchange="$(\'#categoriesForm\').submit();">
							<option value="0">' . $this->l('All') . '</option>';
            foreach ($categories as $category) {
                $this->html .= '<option value="' . $category['id_category'] . '"' . ($id_category == $category['id_category'] ? ' selected="selected"' : '') . '>' . $category['name'] . '</option>';
            }
            $this->html .= '
						</select>
					</div>
				</div>
			</form>
			<h4>' . $this->l('Products available') . '</h4>
			<table class="table" border="0" cellspacing="0" cellspacing="0">
				<thead>
					<tr>
						<th>
							<span class="title_box  active">' . $this->l('Reference') . '</span>
						</th>
						<th>
							<span class="title_box  active">' . $this->l('Name') . '</span>
						</th>
						<th>
							<span class="title_box  active">' . $this->l('Available quantity for sale') . '</span>
						</th>
					</tr>
				</thead>
				<tbody>';
            foreach ($this->getProducts($this->context->language->id) as $product) {
                $this->html .= '
				<tr>
					<td>' . $product['reference'] . '</td>
					<td>
						<a href="' . AdminController::$currentIndex . '&token=' . Tools::safeOutput(Tools::getValue('token')) . '&module=' . $this->name . '&id_product=' . $product['id_product'] . '">' . $product['name'] . '</a>
					</td>
					<td>' . $product['quantity'] . '</td>
				</tr>';
            }
            $this->html .= '
				</tbody>
			</table>
			<a class="btn btn-default export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1">
				<i class="icon-cloud-upload"></i> ' . $this->l('CSV Export') . '
			</a>';
        }
        return $this->html;
    }
开发者ID:dev-lav,项目名称:htdocs,代码行数:101,代码来源:statsproduct.php

示例12: hookAdminStatsModules

    public function hookAdminStatsModules($params)
    {
        global $cookie, $currentIndex;
        $id_category = (int) Tools::getValue('id_category');
        $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
        if (Tools::getValue('export')) {
            if (!Tools::getValue('exportType')) {
                $this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '42'));
            }
        }
        $this->_html = '<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend>';
        if ($id_product = (int) Tools::getValue('id_product')) {
            if (Tools::getValue('export')) {
                if (Tools::getValue('exportType') == 1) {
                    $this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '1-' . $id_product));
                } elseif (Tools::getValue('exportType') == 2) {
                    $this->csvExport(array('type' => 'pie', 'option' => '3-' . $id_product));
                }
            }
            $product = new Product($id_product, false, (int) $cookie->id_lang);
            $totalBought = $this->getTotalBought($product->id);
            $totalSales = $this->getTotalSales($product->id);
            $totalViewed = $this->getTotalViewed($product->id);
            $this->_html .= '<h3>' . $product->name . ' - ' . $this->l('Details') . '</h3>
			<p>' . $this->l('Total bought:') . ' ' . $totalBought . '</p>
			<p>' . $this->l('Sales (-Tx):') . ' ' . Tools::displayprice($totalSales, $currency) . '</p>
			<p>' . $this->l('Total viewed:') . ' ' . $totalViewed . '</p>
			<p>' . $this->l('Conversion rate:') . ' ' . number_format($totalViewed ? $totalBought / $totalViewed : 0, 2) . '</p>
			<center>' . ModuleGraph::engine(array('layers' => 2, 'type' => 'line', 'option' => '1-' . $id_product)) . '</center>
			<br />
			<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=1"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p>';
            if ($hasAttribute = $product->hasAttributes() and $totalBought) {
                $this->_html .= '<h3 class="space">' . $this->l('Attribute sales distribution') . '</h3><center>' . ModuleGraph::engine(array('type' => 'pie', 'option' => '3-' . $id_product)) . '</center><br />
			<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=2"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p><br />';
            }
            if ($totalBought) {
                $sales = $this->getSales($id_product, $cookie->id_lang);
                $this->_html .= '<br class="clear" />
				<h3>' . $this->l('Sales') . '</h3>
				<div style="overflow-y: scroll; height: ' . min(400, (count($sales) + 1) * 32) . 'px;">
				<table class="table" border="0" cellspacing="0" cellspacing="0">
				<thead>
					<tr>
						<th>' . $this->l('Date') . '</th>
						<th>' . $this->l('Order') . '</th>
						<th>' . $this->l('Customer') . '</th>
						' . ($hasAttribute ? '<th>' . $this->l('Attribute') . '</th>' : '') . '
						<th>' . $this->l('Qty') . '</th>
						<th>' . $this->l('Price') . '</th>
					</tr>
				</thead><tbody>';
                $tokenOrder = Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee);
                $tokenCustomer = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee);
                foreach ($sales as $sale) {
                    $this->_html .= '
					<tr>
						<td>' . Tools::displayDate($sale['date_add'], (int) $cookie->id_lang, false) . '</td>
						<td align="center"><a href="?tab=AdminOrders&id_order=' . $sale['id_order'] . '&vieworder&token=' . $tokenOrder . '">' . (int) $sale['id_order'] . '</a></td>
						<td align="center"><a href="?tab=AdminCustomers&id_customer=' . $sale['id_customer'] . '&viewcustomer&token=' . $tokenCustomer . '">' . (int) $sale['id_customer'] . '</a></td>
						' . ($hasAttribute ? '<td>' . $sale['product_name'] . '</td>' : '') . '
						<td>' . (int) $sale['product_quantity'] . '</td>
						<td>' . Tools::displayprice($sale['total'], $currency) . '</td>
					</tr>';
                }
                $this->_html .= '</tbody></table></div>';
                $crossSelling = $this->getCrossSales($id_product, $cookie->id_lang);
                if (count($crossSelling)) {
                    $this->_html .= '<br class="clear" />
					<h3>' . $this->l('Cross Selling') . '</h3>
					<div style="overflow-y: scroll; height: 200px;">
					<table class="table" border="0" cellspacing="0" cellspacing="0">
					<thead>
						<tr>
							<th>' . $this->l('Product name') . '</th>
							<th>' . $this->l('Quantity sold') . '</th>
							<th>' . $this->l('Average price') . '</th>
						</tr>
					</thead><tbody>';
                    $tokenProducts = Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee);
                    foreach ($crossSelling as $selling) {
                        $this->_html .= '
						<tr>
							<td ><a href="?tab=AdminCatalog&id_product=' . (int) $selling['id_product'] . '&addproduct&token=' . $tokenProducts . '">' . $selling['pname'] . '</a></td>
							<td align="center">' . (int) $selling['pqty'] . '</td>
							<td align="right">' . Tools::displayprice($selling['pprice'], $currency) . '</td>
						</tr>';
                    }
                    $this->_html .= '</tbody></table></div>';
                }
            }
        } else {
            $categories = Category::getCategories((int) $cookie->id_lang, true, false);
            $this->_html .= '
			<label>' . $this->l('Choose a category') . '</label>
			<div class="margin-form">
				<form action="" method="post" id="categoriesForm">
					<select name="id_category" onchange="$(\'#categoriesForm\').submit();">
						<option value="0">' . $this->l('All') . '</option>';
            foreach ($categories as $category) {
                $this->_html .= '<option value="' . $category['id_category'] . '"' . ($id_category == $category['id_category'] ? ' selected="selected"' : '') . '>' . $category['name'] . '</option>';
//.........这里部分代码省略.........
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:101,代码来源:statsproduct.php

示例13: generate

 public function generate($cron = false)
 {
     self::setCurrency();
     include 'classes/ymlCatalog.php';
     //Язык по умолчанию
     $id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
     //Валюта по умолчанию
     $currency_default = new Currency($this->context->cookie->id_currency);
     $this->currency_iso = $currency_default->iso_code;
     //Адрес магазина
     $shop_url = 'http://' . Tools::getHttpHost(false, true) . __PS_BASE_URI__;
     //Категории для экспорта
     $yamarket_с_categories = unserialize(Configuration::get('yamarket_с_categories'));
     //$yamarket_с_suppliers = unserialize(Configuration::get('yamarket_с_supplier'));
     $yamarket_с_combinations = Configuration::get('yamarket_с_combinations');
     $this->yamarket_с_availability = Configuration::get('yamarket_с_availability');
     $this->yamarket_с_shipping = unserialize(Configuration::get('yamarket_с_shipping'));
     //создаем новый магазин
     $catalog = new ymlCatalog();
     $catalog->gzip = Configuration::get('yamarket_с_gzip');
     $shop = new ymlShop();
     $shop->name = Configuration::get('yamarket_с_shop');
     $shop->company = Configuration::get('yamarket_с_company');
     $shop->url = $shop_url;
     $shop->platform = 'PrestaShop';
     $shop->version = _PS_VERSION_;
     $shop->agency = 'PrestaLab';
     $shop->email = 'admin@prestalab.ru';
     //Валюты
     $shop->startTag(ymlCurrency::$collectionName);
     if (Configuration::get('yamarket_с_currencies')) {
         $currencies = Currency::getCurrencies();
         foreach ($currencies as $currency) {
             $shop->add(new ymlCurrency($currency['iso_code'], (double) $currency['conversion_rate']));
         }
         unset($currencies);
     } else {
         $shop->add(new ymlCurrency($currency_default->iso_code, (double) $currency_default->conversion_rate));
     }
     $shop->endTag(ymlCurrency::$collectionName);
     //Категории
     $categories = Category::getCategories($id_lang, false, false);
     $shop->startTag(ymlCategory::$collectionName);
     foreach ($categories as $category) {
         if ($category['active'] && in_array($category['id_category'], $yamarket_с_categories)) {
             $shop->add(new ymlCategory($category['id_category'], $category['name'], $category['id_parent']));
         }
     }
     $shop->endTag(ymlCategory::$collectionName);
     //Стоимость доставки
     $shop->addString('<local_delivery_cost>' . Configuration::get('yamarket_с_shippingcost') . '</local_delivery_cost>');
     //Товары
     $shop->startTag(ymlOffer::$collectionName);
     foreach ($categories as $category) {
         if ($category['active'] && in_array($category['id_category'], $yamarket_с_categories)) {
             $category_object = new Category($category['id_category']);
             $products = $category_object->getProducts($id_lang, 1, 10000);
             if ($products) {
                 foreach ($products as $product) {
                     if ($product['id_category_default'] != $category['id_category']) {
                         continue;
                     }
                     //						if (count($yamarket_с_suppliers)&&(!in_array($product['id_supplier'], $yamarket_с_suppliers)))
                     //							continue;
                     //Для комбинаций
                     if ($yamarket_с_combinations) {
                         $product_object = new Product($product['id_product'], false, $id_lang);
                         $combinations = $product_object->getAttributeCombinations($id_lang);
                     } else {
                         $combinations = false;
                     }
                     if (is_array($combinations) && count($combinations) > 0) {
                         $comb_array = array();
                         foreach ($combinations as $combination) {
                             $comb_array[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute'];
                             $comb_array[$combination['id_product_attribute']]['price'] = Product::getPriceStatic($product['id_product'], true, $combination['id_product_attribute']);
                             $comb_array[$combination['id_product_attribute']]['reference'] = $combination['reference'];
                             $comb_array[$combination['id_product_attribute']]['ean13'] = $combination['ean13'];
                             $comb_array[$combination['id_product_attribute']]['quantity'] = $combination['quantity'];
                             $comb_array[$combination['id_product_attribute']]['attributes'][$combination['group_name']] = $combination['attribute_name'];
                             $comb_array[$combination['id_product_attribute']]['oldprice'] = $product['orderprice'] + $combination['price'];
                             if (!isset($comb_array[$combination['id_product_attribute']]['comb_url'])) {
                                 $comb_array[$combination['id_product_attribute']]['comb_url'] = '';
                             }
                             $comb_array[$combination['id_product_attribute']]['comb_url'] .= '/' . (self::combinationUrlPrepare($combination['group_name']) . '-' . self::combinationUrlPrepare($combination['attribute_name']));
                         }
                         foreach ($comb_array as $combination) {
                             self::_addProduct($shop, $product, $combination);
                         }
                     } else {
                         self::_addProduct($shop, $product);
                     }
                 }
             }
             unset($product);
         }
     }
     unset($categories);
     $shop->endTag(ymlOffer::$collectionName);
     $catalog->add($shop);
//.........这里部分代码省略.........
开发者ID:Beattle,项目名称:perrino-shop,代码行数:101,代码来源:yamarket.php

示例14: edit

 public function edit($id)
 {
     $domain = Domain::find($id);
     $categories = Category::getCategories();
     return View::make('domains.edit')->with(compact('domain', 'categories'));
 }
开发者ID:CalinB,项目名称:web-directory,代码行数:6,代码来源:DomainsController.php

示例15: generate

 public function generate($to_file = true)
 {
     $link = new Link();
     include_once 'YMarket.class.php';
     //Язык по умолчанию
     $id_lang = intval(Configuration::get('PS_LANG_DEFAULT'));
     //Валюта по умолчанию
     $curr_def = new Currency(intval(Configuration::get('PS_CURRENCY_DEFAULT')));
     //создаем новый магазин
     $market = new YMarket($this->_settings['y_sn'], $this->_settings['y_fn'], 'http://' . Tools::getHttpHost(false, true), $this->_settings['y_ldc']);
     //Валюты
     if ($this->_settings['y_cu']) {
         $currencies = Currency::getCurrencies();
         foreach ($currencies as $currency) {
             $market->add(new yCurrency($currency['iso_code'], floatval($currency['conversion_rate'])));
         }
         unset($currencies);
     } else {
         $market->add(new yCurrency($curr_def->iso_code, floatval($curr_def->conversion_rate)));
     }
     //Категории
     $categories = Category::getCategories($id_lang, false, false);
     foreach ($categories as $category) {
         $catdesc = $category['meta_title'] ? $category['meta_title'] : $category['name'];
         $market->add(new yCategory($category['id_category'], $catdesc, $category['id_parent']));
     }
     unset($categories);
     //Продукты
     $products = self::getProducts($id_lang);
     while ($product = Db::getInstance()->nextRow($products)) {
         $tmp = new yOffer($product['id_product'], $product['name'], Product::getPriceStatic($product['id_product'], $usetax = true, NULL, $decimals = 2, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = true));
         $tmp->id = $product['id_product'];
         $tmp->type = '';
         $tmp->sales_notes = $this->_settings['y_sl'];
         $tmp->url = $link->getProductLink((int) $product['id_product'], $product['link_rewrite']);
         //Картинка
         if ($cover = self::getCover($product['id_product'])) {
             $tmp->picture = $link->getImageLink($product['link_rewrite'], $cover);
         }
         $tmp->currencyId = $curr_def->iso_code;
         $tmp->categoryId = $product['id_category_default'];
         //$tmp->vendorCode = $product['reference'];
         $tmp->description = $product['description'];
         if ($this->_settings['y_dl']) {
             $tmp->delivery = 'true';
         } else {
             $tmp->delivery = 'false';
         }
         switch ($this->_settings['y_av']) {
             case 1:
                 $tmp->available = $product['quantity'] == 0 ? 'false' : 'true';
                 break;
             case 3:
                 $tmp->available = 'false';
                 break;
             default:
                 $tmp->available = 'true';
         }
         //$tmp->barcode = $product['ean13'];
         if (ProductDownload::getIdFromIdProduct($product['id_product'])) {
             $tmp->downloadable = 'true';
         }
         if (!($this->_settings['y_av'] == 2 and $product['quantity'] == 0)) {
             $market->add($tmp);
         }
     }
     if ($to_file) {
         $fp = fopen(dirname(__FILE__) . '/../../upload/yml.xml' . ($this->_settings['y_gz'] ? '.gz' : ''), 'w');
         fwrite($fp, $market->generate(false, $this->_settings['y_gz']));
         fclose($fp);
     } else {
         $market->generate(true, $this->_settings['y_gz']);
     }
 }
开发者ID:HueJack,项目名称:yamarket-prestashop-module,代码行数:74,代码来源:yamarket.php


注:本文中的Category::getCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。