本文整理汇总了PHP中Manufacturer类的典型用法代码示例。如果您正苦于以下问题:PHP Manufacturer类的具体用法?PHP Manufacturer怎么用?PHP Manufacturer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Manufacturer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
function update(Manufacturer $man)
{
$query = "UPDATE `manufacturer` SET `idmanufacturer`='" . $man->getIdmanufacturer() . "',`manufacturer_name`='" . $man->getManufacturerName() . "',`address_number`='" . $man->getAddressNumber() . "',`address_street`='" . $man->getAddressStreet() . "',`address_city`='" . $man->getAddressCity() . "',`address_country`='" . $man->getAddressCountry() . "',`contact_number`='" . $man->getContactNumber() . "' WHERE `idmanufacturer`='" . $man->getIdmanufacturer() . "'";
$this->con->openConnection();
$this->con->executeRawQuery($query);
$this->con->closeConnection();
}
示例2: getTemplateVarSitemap
public function getTemplateVarSitemap()
{
$pages = [];
$catalog_mode = Configuration::isCatalogMode();
$cms = CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1);
foreach ($cms['cms'] as $p) {
$pages[] = ['id' => 'cms-page-' . $p['id_cms'], 'label' => $p['meta_title'], 'url' => $this->context->link->getCMSLink(new CMS($p['id_cms']))];
}
$pages[] = ['id' => 'stores-page', 'label' => $this->trans('Our stores', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('stores')];
$pages[] = ['id' => 'contact-page', 'label' => $this->trans('Contact us', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('contact')];
$pages[] = ['id' => 'sitemap-page', 'label' => $this->trans('Sitemap', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('sitemap')];
$pages[] = ['id' => 'login-page', 'label' => $this->trans('Log in', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('authentication')];
$pages[] = ['id' => 'register-page', 'label' => $this->trans('Create new account', array(), 'Shop.Theme'), 'url' => $this->context->link->getPageLink('authentication')];
$catalog = ['new-product' => ['id' => 'new-product-page', 'label' => $this->trans('New products', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('new-products')]];
if ($catalog_mode && Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
$catalog['best-sales'] = ['id' => 'best-sales-page', 'label' => $this->trans('Best sellers', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('best-sales')];
$catalog['prices-drop'] = ['id' => 'prices-drop-page', 'label' => $this->trans('Price drop', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('prices-drop')];
}
if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
$manufacturers = Manufacturer::getLiteManufacturersList($this->context->language->id, 'sitemap');
$catalog['manufacturer'] = ['id' => 'manufacturer-page', 'label' => $this->trans('Manufacturers', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('manufacturer'), 'children' => $manufacturers];
$suppliers = Supplier::getLiteSuppliersList($this->context->language->id, 'sitemap');
$catalog['supplier'] = ['id' => 'supplier-page', 'label' => $this->trans('Suppliers', array(), 'Shop.Theme.Catalog'), 'url' => $this->context->link->getPageLink('supplier'), 'children' => $suppliers];
}
$categories = Category::getRootCategory()->recurseLiteCategTree(0, 0, null, null, 'sitemap');
$catalog['category'] = ['id' => 'category-page', 'label' => $this->trans('Categories', array(), 'Shop.Theme.Catalog'), 'url' => '#', 'children' => $categories['children']];
$sitemap = [['id' => 'page-page', 'label' => $this->trans('Pages', array(), 'Shop.Theme'), 'url' => '#', 'children' => $pages], ['id' => 'catalog-page', 'label' => $this->trans('Catalog', array(), 'Shop.Theme'), 'url' => '#', 'children' => $catalog]];
return $sitemap;
}
示例3: hookProductFooter
public function hookProductFooter($params)
{
$id_product = (int) $params['product']->id;
$product = $params['product'];
if (isset($params['product']->id_manufacturer) && $params['product']->id_manufacturer) {
$cache_id = 'productsmanufacturer|' . $id_product . '|' . (int) $params['product']->id_manufacturer;
if (!$this->isCached('productsmanufacturer.tpl', $this->getCacheId($cache_id))) {
// Get infos
$manufacturer_products = Manufacturer::getProducts($params['product']->id_manufacturer, $this->context->language->id, 1, Configuration::get('pmslid_limit'));
/* 100 products max. */
// Remove current product from the list
if (is_array($manufacturer_products) && count($manufacturer_products)) {
foreach ($manufacturer_products as $key => $manufacturer_product) {
if ($manufacturer_product['id_product'] == $id_product) {
unset($manufacturer_products[$key]);
break;
}
}
$taxes = Product::getTaxCalculationMethod();
if (!Configuration::get('pmslid_DISPLAY_PRICE')) {
foreach ($manufacturer_products as $key => $manufacturer_product) {
if ($manufacturer_product['id_product'] != $id_product) {
$manufacturer_products[$key]['show_price'] = 0;
}
}
}
}
// Display tpl
$this->smarty->assign(array('manufacturer_products' => $manufacturer_products, 'ProdDisplayPrice' => Configuration::get('pmslid_DISPLAY_PRICE')));
}
return $this->display(__FILE__, 'productsmanufacturer.tpl', $this->getCacheId($cache_id));
}
}
示例4: run
public function run()
{
$inn = false;
$cat = Category::model()->with('categoryDescriptions')->find('categoryDescriptions.link=:link', array(':link' => $this->current));
if (!empty($cat)) {
$catName = $cat->getName();
$categories = $cat->categories;
if (empty($categories)) {
$categories = array($cat);
$inn = true;
}
//echo print_r($categories);
} else {
$catName = 'All';
$categories = Category::model()->findAll();
}
$products = array();
$nbrands = $brands = array();
foreach ($categories as $category) {
$products = array_merge($products, $category->products);
}
foreach ($products as $product) {
$nbrands[] = $product->manufacturer_id;
}
$nbrands = array_unique($nbrands, SORT_NUMERIC);
foreach ($nbrands as $nbrand) {
$manu = Manufacturer::model()->findByPk($nbrand);
if (!empty($manu)) {
$brands[$nbrand] = $manu->name;
}
}
//$brands = asort($brands);
$this->render('category_navigation', array('inn' => $inn, 'cat' => $cat, 'name' => $catName, 'categories' => $categories, 'products' => $products, 'brands' => $brands, 'current' => $this->current));
}
示例5: hookLeftColumn
public function hookLeftColumn($params)
{
if (!$this->isCached('blockmanufacturer.tpl', $this->getCacheId())) {
$this->smarty->assign(array('manufacturers' => Manufacturer::getManufacturers(), 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS')));
}
return $this->display(__FILE__, 'blockmanufacturer.tpl', $this->getCacheId());
}
示例6: show
/**
* Display the specified dashboard.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$products = Product::all();
$records = Record::all();
$manufacturers = Manufacturer::all();
return View::make('Dashboard.index', compact('records', 'products', 'manufacturers'));
}
示例7: renderForm
public function renderForm()
{
if (!$this->object->id) {
$this->object->price = -1;
}
$this->fields_form = array('legend' => array('title' => $this->l('Catalog price rules'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.)'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->l('From'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->l('To'), 'name' => 'to'), array('type' => 'select', 'label' => $this->l('Reduction type'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Reduction with or without taxes'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->l('Tax included'), 'val' => 1), array('lab' => $this->l('Tax excluded'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save')));
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 6);
} else {
$price = '';
}
$this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1);
$attribute_groups = array();
$attributes = Attribute::getAttributes((int) $this->context->language->id);
foreach ($attributes as $attribute) {
if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
$attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
}
$attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
}
$features = Feature::getFeatures((int) $this->context->language->id);
foreach ($features as &$feature) {
$feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
}
$this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
return parent::renderForm();
}
示例8: testEavQueue
public function testEavQueue()
{
// set up Manufacturer records
$field = EavField::getNewInstance('Manufacturer', EavField::DATATYPE_TEXT, EavField::TYPE_TEXT_SIMPLE);
$field->save();
$data = array('first', 'second', 'third');
foreach ($data as $value) {
$manufacturer = Manufacturer::getNewInstance($value);
$manufacturer->getSpecification()->setAttributeValueByLang($field, 'en', $value . ' test');
$manufacturer->save();
}
ActiveRecordModel::clearPool();
// fetch them from database
$manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', new ARSelectFilter());
foreach ($manufacturers as &$entry) {
ActiveRecordModel::addToEavQueue('Manufacturer', $entry);
}
// duplicate
$manufacturers = array_merge($manufacturers, $manufacturers);
// load EAV data
ActiveRecordModel::loadEav();
foreach ($manufacturers as $man) {
$this->assertEqual($man['name'] . ' test', $man['attributes'][$field->getID()]['value_en']);
}
}
示例9: _getEndJs
/**
* (non-PHPdoc)
* @see CRUDPageAbstract::_getEndJs()
*/
protected function _getEndJs()
{
$manufactureArray = $supplierArray = $statuses = $productCategoryArray = array();
foreach (Manufacturer::getAll() as $os) {
$manufactureArray[] = $os->getJson();
}
foreach (Supplier::getAll() as $os) {
$supplierArray[] = $os->getJson();
}
foreach (ProductStatus::getAll() as $os) {
$statuses[] = $os->getJson();
}
foreach (ProductCategory::getAll() as $os) {
$productCategoryArray[] = $os->getJson();
}
$js = parent::_getEndJs();
if (($product = Product::get($this->Request['id'])) instanceof Product) {
$js .= "\$('searchPanel').hide();";
$js .= "pageJs._singleProduct = true;";
}
$js .= 'pageJs._loadManufactures(' . json_encode($manufactureArray) . ')';
$js .= '._loadSuppliers(' . json_encode($supplierArray) . ')';
$js .= '._loadCategories(' . json_encode($productCategoryArray) . ')';
$js .= '._loadProductStatuses(' . json_encode($statuses) . ')';
$js .= "._loadChosen()";
$js .= "._bindSearchKey()";
$js .= ".setCallbackId('priceMatching', '" . $this->priceMatchingBtn->getUniqueID() . "')";
$js .= ".setCallbackId('toggleActive', '" . $this->toggleActiveBtn->getUniqueID() . "')";
$js .= ".getResults(true, " . $this->pageSize . ");";
return $js;
}
示例10: hookHome
function hookHome($params)
{
global $smarty, $cookie;
$manufacturer = Manufacturer::getManufacturers(false, $cookie->id_lang, true);
$smarty->assign(array('manufacturer' => $manufacturer));
return $this->display(__FILE__, 'tdmanufacturerblock.tpl');
}
示例11: loadModel
public function loadModel($id)
{
$model = Manufacturer::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例12: actionAutocomplete
public function actionAutocomplete($query)
{
$json = array();
$manufacturers = Manufacturer::model()->findAll("name LIKE '%{$query}%' ");
foreach ($manufacturers as $manufacturer) {
$json[] = array('id' => $manufacturer->manufacturer_id, 'value' => $manufacturer->name);
}
echo CJSON::encode($json);
}
示例13: postProcess
/**
* Method postProcess() : add or update manufacturer object
*
* @module now_seo_links
* @return object Manufacturer
*
* @see AdminManufacturersControllerCore::postProcess()
*/
public function postProcess()
{
$aShops = array_keys(Tools::getValue('checkBoxShopAsso_manufacturer', array()));
// Check if name already exist
if (Manufacturer::nameIsAlreadyUsed(Tools::getValue('id_manufacturer'), Tools::getValue('name'), $aShops)) {
$this->errors[] = Tools::displayError('Ce nom de marque existe déjà et ne peut être utilisé une nouvelle fois.');
}
return parent::postProcess();
}
示例14: getProductLink
/**
* Create a link to a product
*
* @param mixed $product Product object (can be an ID product, but deprecated)
* @param string $alias
* @param string $category
* @param string $ean13
* @param int $id_lang
* @param int $id_shop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
* @param int $ipa ID product attribute
* @return string
*/
public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false, $relative_protocol = false, $add_anchor = false)
{
$dispatcher = Dispatcher::getInstance();
if (!$id_lang) {
$id_lang = Context::getContext()->language->id;
}
$url = $this->getBaseLink($id_shop, null, $relative_protocol) . $this->getLangLink($id_lang, null, $id_shop);
if (!is_object($product)) {
if (is_array($product) && isset($product['id_product'])) {
$product = new Product($product['id_product'], false, $id_lang, $id_shop);
} elseif ((int) $product) {
$product = new Product((int) $product, false, $id_lang, $id_shop);
} else {
throw new PrestaShopException('Invalid product vars');
}
}
// Set available keywords
$params = array();
$params['id'] = $product->id;
$params['rewrite'] = !$alias ? $product->getFieldByLang('link_rewrite') : $alias;
$params['ean13'] = !$ean13 ? $product->ean13 : $ean13;
$params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
$params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'manufacturer', $id_shop)) {
$params['manufacturer'] = Tools::str2url($product->isFullyLoaded ? $product->manufacturer_name : Manufacturer::getNameById($product->id_manufacturer));
}
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'supplier', $id_shop)) {
$params['supplier'] = Tools::str2url($product->isFullyLoaded ? $product->supplier_name : Supplier::getNameById($product->id_supplier));
}
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'price', $id_shop)) {
$params['price'] = $product->isFullyLoaded ? $product->price : Product::getPriceStatic($product->id, false, null, 6, null, false, true, 1, false, null, null, null, $product->specificPrice);
}
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'tags', $id_shop)) {
$params['tags'] = Tools::str2url($product->getTags($id_lang));
}
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'category', $id_shop)) {
$params['category'] = !is_null($product->category) && !empty($product->category) ? Tools::str2url($product->category) : Tools::str2url($category);
}
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'reference', $id_shop)) {
$params['reference'] = Tools::str2url($product->reference);
}
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories', $id_shop)) {
$params['category'] = !$category ? $product->category : $category;
$cats = array();
foreach ($product->getParentCategories($id_lang) as $cat) {
if (!in_array($cat['id_category'], Link::$category_disable_rewrite)) {
//remove root and home category from the URL
$cats[] = $cat['link_rewrite'];
}
}
$params['categories'] = implode('/', $cats);
}
$anchor = $ipa ? $product->getAnchor((int) $ipa, (bool) $add_anchor) : '';
return $url . $dispatcher->createUrl('product_rule', $id_lang, $params, $force_routes, $anchor, $id_shop);
}
示例15: renderForm
/**
* @return mixed
*/
public function renderForm()
{
if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) {
$link = $obj->getImageLink();
if (file_exists($obj->getImageLink(_PS_IMG_DIR_))) {
$size = round(filesize($obj->getImageLink(_PS_IMG_DIR_)) / 1024);
}
}
$this->fields_form = array('legend' => array('title' => $this->module->l('Block Slideshow', 'AdminNowSlideshow'), 'icon' => 'icon-list-alt'), 'input' => array(array('type' => 'text', 'label' => $this->module->l('Name', 'AdminNowSlideshow'), 'name' => 'name', 'required' => true, 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Title', 'AdminNowSlideshow'), 'name' => 'title', 'required' => true, 'lang' => true), array('type' => 'text', 'label' => $this->module->l('Button name', 'AdminNowSlideshow'), 'name' => 'button_name', 'required' => true, 'lang' => true), array('type' => 'textarea', 'label' => $this->module->l('Description', 'AdminNowSlideshow'), 'name' => 'description', 'required' => true, 'lang' => true, 'autoload_rte' => true), array('type' => 'select', 'label' => $this->module->l('Type of link', 'AdminNowSlideshow'), 'name' => 'type', 'required' => true, 'default_value' => NowSlideshow::TYPE_LINK, 'options' => array('query' => array(array('id_type' => NowSlideshow::TYPE_CATEGORY, 'type' => $this->module->l('Category', 'AdminNowSlideshow')), array('id_type' => NowSlideshow::TYPE_CMS, 'type' => $this->module->l('CMS', 'AdminNowSlideshow')), array('id_type' => NowSlideshow::TYPE_LINK, 'type' => $this->module->l('Link', 'AdminNowSlideshow')), array('id_type' => NowSlideshow::TYPE_MANUFACTURER, 'type' => $this->module->l('Manufacturer', 'AdminNowSlideshow'))), 'id' => 'id_type', 'name' => 'type')), array('type' => 'text', 'label' => $this->module->l('ID type', 'AdminNowSlideshow'), 'name' => 'id_type', 'form_group_class' => 'idTypeDiv'), array('type' => 'categories', 'label' => $this->l('Category'), 'name' => 'category', 'tree' => array('id' => 'categories-tree'), 'form_group_class' => 'categoryDiv'), array('type' => 'select', 'label' => $this->module->l('CMS', 'AdminNowSlideshow'), 'name' => 'cms', 'options' => array('query' => CMS::listCms($this->context->language->id), 'id' => 'id_cms', 'name' => 'meta_title'), 'form_group_class' => 'cmsDiv'), array('type' => 'select', 'label' => $this->module->l('Manufacturer', 'AdminNowSlideshow'), 'name' => 'manufacturer', 'options' => array('query' => Manufacturer::getManufacturers(false, $this->context->language->id), 'id' => 'id_manufacturer', 'name' => 'name'), 'form_group_class' => 'manufacturerDiv'), array('type' => 'text', 'label' => $this->module->l('Link', 'AdminNowSlideshow'), 'name' => 'link', 'form_group_class' => 'linkDiv', 'lang' => true), array('type' => 'file', 'label' => $this->module->l('Image (.png)', 'AdminNowSlideshow'), 'name' => 'image', 'display_image' => true, 'show_thumbnail' => true, 'image' => isset($link) ? '<img src="' . $link . '"/>' : null, 'size' => isset($size) ? $size : null), array('type' => 'switch', 'label' => $this->module->l('Enable', 'AdminNowSlideshow'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->module->l('Enabled', 'AdminNowSlideshow')), array('id' => 'active_off', 'value' => 0, 'label' => $this->module->l('Disabled', 'AdminNowSlideshow'))))), 'submit' => array('title' => $this->module->l('Save', 'AdminNowSlideshow')));
return parent::renderForm();
}