public function index() { if ($this->config->get('google_sitemap_status')) { $output = '<?xml version="1.0" encoding="UTF-8"?>'; $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $this->load->model('catalog/product'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { $output .= '<url>'; $output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</loc>'; $output .= '<lastmod>' . substr(max($product['date_added'], $product['date_modified']), 0, 10) . '</lastmod>'; $output .= '<changefreq>weekly</changefreq>'; $output .= '<priority>1.0</priority>'; $output .= '</url>'; } $this->load->model('catalog/category'); $output .= $this->getCategories(0); $manufacturers = ManufacturerDAO::getInstance()->getManufacturers(); foreach ($manufacturers as $manufacturer) { $output .= '<url>'; $output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $manufacturer->getId()))) . '</loc>'; $output .= '<changefreq>weekly</changefreq>'; $output .= '<priority>0.7</priority>'; $output .= '</url>'; } $this->load->model('catalog/information'); $informations = $this->model_catalog_information->getInformations(); foreach ($informations as $information) { $output .= '<url>'; $output .= '<loc>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('information/information', 'information_id=' . $information['information_id']))) . '</loc>'; $output .= '<changefreq>weekly</changefreq>'; $output .= '<priority>0.5</priority>'; $output .= '</url>'; } $output .= '</urlset>'; $this->getResponse()->addHeader('Content-Type: application/xml'); $this->getResponse()->setOutput($output); } }
public function edit() { $this->initModel(); /// Initialize general elements $this->data = array_merge($this->data, $this->parameters); $this->data['manufacturers'] = ManufacturerDAO::getInstance()->getManufacturers(); $this->data['suppliers'] = SupplierDAO::getInstance()->getSuppliers(); $this->data['textAddEntry'] = $this->language->get("ADD_ENTRY"); $this->data['textCancel'] = $this->language->get("CANCEL"); $this->data['textClassName'] = $this->language->get("CLASS"); $this->data['textDefaultCategories'] = $this->language->get("DEFAULT_CATEGORIES"); $this->data['textDefaultItemWeight'] = $this->language->get("DEFAULT_ITEM_WEIGHT"); $this->data['textDefaultManufacturer'] = $this->language->get("DEFAULT_MANUFACTURER"); $this->data['textDefaultSupplier'] = $this->language->get("DEFAULT_SUPPLIER"); $this->data['textLocalCategoryId'] = $this->language->get("LOCAL_CATEGORY_ID"); $this->data['textImportMappedCategoriesOnly'] = $this->language->get("IMPORT_MAPPED_CATEGORIES_ONLY"); $this->data['textRegularCustomerPriceRate'] = $this->language->get("PRICE_RATE_REGULAR_CUSTOMER"); $this->data['textRemoveEntry'] = $this->language->get("DELETE"); $this->data['textSave'] = $this->language->get("SAVE"); $this->data['textSaveContinueEdit'] = $this->language->get("SAVE_CONTINUE_EDIT"); $this->data['textSourceSiteCategoryId'] = $this->language->get("SOURCE_SITE_CATEGORY_ID"); $this->data['textSiteName'] = $this->language->get("SITE"); $this->data['textStores'] = $this->language->get("STORES"); $this->data['textWholesaleCustomerPriceRate'] = $this->language->get("PRICE_RATE_WHOLESALE_CUSTOMER"); $this->data['urlAction'] = $this->selfUrl; $this->data['urlList'] = $this->getUrl()->link('extension/import', 'token=' . $this->parameters['token'], 'SSL'); $this->setBreadcrumbs(); $this->children = array('common/header', 'common/footer'); /// Process site data $this->data['importSite'] = $this->model; if ($this->getRequest()->getMethod() == 'GET') { $this->editGET($this->model); } elseif ($this->getRequest()->getMethod() == 'POST') { $this->editPOST($this->model); } $this->getResponse()->setOutput($this->render('extension/importForm.tpl.php')); }
private function getForm() { if ($this->getConfig()->get('wk_auction_timezone_set')) { if (sizeof($this->model->getAuctions())) { $this->data['isauction'] = $this->model->getAuctions()[0]->isAuction(); $this->data['auction_min'] = $this->model->getAuctions()[0]->getMin(); $this->data['auction_max'] = $this->model->getAuctions()[0]->getMax(); $this->data['auction_end'] = $this->model->getAuctions()[0]->getEndDate(); $this->data['auction_start'] = $this->model->getAuctions()[0]->getStartDate(); $this->data['auction_name'] = $this->model->getAuctions()[0]->getName(); } else { $this->data['isauction'] = 0; $this->data['auction_min'] = ''; $this->data['auction_max'] = ''; $this->data['auction_end'] = ''; $this->data['auction_start'] = ''; $this->data['auction_name'] = ''; } } if (isset($this->error['warning'])) { $this->data['error_warning'] = $this->error['warning']; } else { $this->data['error_warning'] = ''; } if (isset($this->error['name'])) { $this->data['error_name'] = $this->error['name']; } else { $this->data['error_name'] = array(); } if (isset($this->error['meta_description'])) { $this->data['error_meta_description'] = $this->error['meta_description']; } else { $this->data['error_meta_description'] = array(); } if (isset($this->error['description'])) { $this->data['error_description'] = $this->error['description']; } else { $this->data['error_description'] = array(); } if (isset($this->error['model'])) { $this->data['error_model'] = $this->error['model']; } else { $this->data['error_model'] = ''; } if (isset($this->error['date_available'])) { $this->data['error_date_available'] = $this->error['date_available']; } else { $this->data['error_date_available'] = ''; } $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $this->setBreadcrumbs(); $this->data['model'] = $this->model; if (!$this->model->getId()) { $this->data['action'] = $this->getUrl()->link('catalog/product/insert', 'token=' . $this->getSession()->data['token'] . $url, 'SSL'); } else { $this->data['action'] = $this->getUrl()->link('catalog/product/update', 'token=' . $this->getSession()->data['token'] . '&product_id=' . $this->model->getId() . $url, 'SSL'); } $this->data['cancel'] = $this->getUrl()->link('catalog/product', 'token=' . $this->getSession()->data['token'] . $url, 'SSL'); $this->data['token'] = $this->getSession()->data['token']; // if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { // $product_info = ProductDAO::getInstance()->getProduct($this->getRequest()->getParam('product_id')); // } $this->data['languages'] = $this->getLoader()->model('localisation/language')->getLanguages(); // if (isset($this->request->post['product_description'])) { // $this->data['product_description'] = $this->request->post['product_description']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_description'] = ProductDAO::getInstance()->getDescription($this->request->get['product_id']); // } else { // $this->data['product_description'] = new Description($this->getLanguage()->getId(), ''); // } // if (isset($this->request->post['model'])) { // $this->data['model'] = $this->request->post['model']; // } elseif (!empty($product_info)) { // $this->data['model'] = $product_info['model']; // } else { // $this->data['model'] = ''; // } // if (isset($this->request->post['sku'])) { // $this->data['sku'] = $this->request->post['sku']; // } elseif (!empty($product_info)) { // $this->data['sku'] = $product_info['sku']; // } else { // $this->data['sku'] = ''; // } // // if (isset($this->request->post['upc'])) { // $this->data['upc'] = $this->request->post['upc']; // } elseif (!empty($product_info)) { // $this->data['upc'] = $product_info['upc']; // } else { // $this->data['upc'] = ''; // } // // if (isset($this->request->post['location'])) { // $this->data['location'] = $this->request->post['location']; // } elseif (!empty($product_info)) { // $this->data['location'] = $product_info['location']; // } else { // $this->data['location'] = ''; // } // if (isset($this->request->post['image_description'])) { // $this->data['image_description'] = $this->request->post['image_description']; // } elseif (!empty($product_info)) { // $this->data['image_description'] = $product_info['image_description']; // } else { // $this->data['image_description'] = ''; // } // // if (isset($this->request->post['image'])) { // $this->data['image'] = $this->request->post['image']; // } elseif (!empty($product_info)) { // $this->data['image'] = $product_info['image']; // } else { // $this->data['image'] = ''; // } // if (!empty($product_info) && $product_info['image'] && file_exists(DIR_IMAGE . $product_info['image'])) { // $this->data['thumb'] = ImageService::getInstance()->resize($product_info['image'], 100, 100); // } else { // $this->data['thumb'] = ImageService::getInstance()->resize('no_image.jpg', 100, 100); // } $this->data['stores'] = StoreDAO::getInstance()->getStores(); // if (isset($this->request->post['product_store'])) { // $this->data['product_store'] = $this->request->post['product_store']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_store'] = ProductDAO::getInstance()->getStores($this->request->get['product_id']); // } else { // $this->data['product_store'] = array(0); // } // if (isset($this->request->post['keyword'])) { // $this->data['keyword'] = $this->request->post['keyword']; // } elseif (!empty($product_info)) { // $this->data['keyword'] = $product_info['keyword']; // } else { // $this->data['keyword'] = ''; // } // if (isset($this->request->post['product_tag'])) { // $this->data['product_tag'] = $this->request->post['product_tag']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_tag'] = ProductDAO::getInstance()->getProductTags($this->request->get['product_id']); // } else { // $this->data['product_tag'] = array(); // } $this->data['manufacturers'] = ManufacturerDAO::getInstance()->getManufacturers(); // if (isset($this->request->post['manufacturer_id'])) { // $this->data['manufacturer_id'] = $this->request->post['manufacturer_id']; // } elseif (!empty($product_info)) { // $this->data['manufacturer_id'] = $product_info['manufacturer_id']; // } else { // $this->data['manufacturer_id'] = 0; // } $this->data['suppliers'] = SupplierDAO::getInstance()->getSuppliers(); // if (isset($this->request->post['supplier_id'])) { // $this->data['supplier_id'] = $this->request->post['supplier_id']; // } elseif (!empty($product_info)) { // $this->data['supplier_id'] = $product_info['supplier_id']; // } else { // $this->data['supplier_id'] = 0; // } // if (isset($this->request->post['shipping'])) { // $this->data['shipping'] = $this->request->post['shipping']; // } elseif (!empty($product_info)) { // $this->data['shipping'] = $product_info['shipping']; // } else { // $this->data['shipping'] = 1; // } // // if (isset($this->request->post['price'])) { // $this->data['price'] = $this->request->post['price']; // } else if (!empty($product_info)) { // $this->data['price'] = $product_info['price']; // } else { // $this->data['price'] = ''; // } // $this->data['tax_classes'] = $this->getLoader()->model('localisation/tax_class')->getTaxClasses(); // // if (isset($this->request->post['tax_class_id'])) { // $this->data['tax_class_id'] = $this->request->post['tax_class_id']; // } else if (!empty($product_info)) { // $this->data['tax_class_id'] = $product_info['tax_class_id']; // } else { // $this->data['tax_class_id'] = 0; // } // if (isset($this->request->post['date_available'])) { // $this->data['date_available'] = $this->request->post['date_available']; // } elseif (!empty($product_info)) { // $this->data['date_available'] = date('Y-m-d', strtotime($product_info['date_available'])); // } else { // $this->data['date_available'] = date('Y-m-d', time() - 86400); // } // // if (isset($this->request->post['quantity'])) { // $this->data['quantity'] = $this->request->post['quantity']; // } elseif (!empty($product_info)) { // $this->data['quantity'] = $product_info['quantity']; // } else { // $this->data['quantity'] = ''; // } // if (isset($this->request->post['minimum'])) { // $this->data['minimum'] = $this->request->post['minimum']; // } elseif (!empty($product_info)) { // $this->data['minimum'] = $product_info['minimum']; // } else { // $this->data['minimum'] = 1; // } // if (isset($this->request->post['subtract'])) { // $this->data['subtract'] = $this->request->post['subtract']; // } elseif (!empty($product_info)) { // $this->data['subtract'] = $product_info['subtract']; // } else { // $this->data['subtract'] = 0; // } // if (isset($this->request->post['sort_order'])) { // $this->data['sort_order'] = $this->request->post['sort_order']; // } elseif (!empty($product_info)) { // $this->data['sort_order'] = $product_info['sort_order']; // } else { // $this->data['sort_order'] = 1; // } $this->data['stock_statuses'] = $this->getLoader()->model('localisation/stock_status')->getStockStatuses(); // // if (isset($this->request->post['stock_status_id'])) { // $this->data['stock_status_id'] = $this->request->post['stock_status_id']; // } else if (!empty($product_info)) { // $this->data['stock_status_id'] = $product_info['stock_status_id']; // } else { // $this->data['stock_status_id'] = $this->getConfig()->get('config_stock_status_id'); // } // if (isset($this->request->post['status'])) { // $this->data['status'] = $this->request->post['status']; // } else if (!empty($product_info)) { // $this->data['status'] = $product_info['status']; // } else { // $this->data['status'] = 1; // } // if (isset($this->request->post['affiliate_commission'])) { // $this->data['affiliate_commission'] = $this->request->post['affiliate_commission']; // } elseif (!empty($product_info)) { // $this->data['affiliate_commission'] = $product_info['affiliate_commission']; // } else { // $this->data['affiliate_commission'] = 0; // } // if (isset($this->request->post['weight'])) { // $this->data['weight'] = $this->request->post['weight']; // } else if (!empty($product_info)) { // $this->data['weight'] = $product_info['weight']; // } else { // $this->data['weight'] = ''; // } $this->data['weight_classes'] = MeasureUnitDAO::getInstance()->getWeightClasses(); // // if (isset($this->request->post['weight_class_id'])) { // $this->data['weight_class_id'] = $this->request->post['weight_class_id']; // } elseif (!empty($product_info)) { // $this->data['weight_class_id'] = $product_info['weight_class_id']; // } else { // $this->data['weight_class_id'] = $this->getConfig()->get('config_weight_class_id'); // } // if (isset($this->request->post['length'])) { // $this->data['length'] = $this->request->post['length']; // } elseif (!empty($product_info)) { // $this->data['length'] = $product_info['length']; // } else { // $this->data['length'] = ''; // } // // if (isset($this->request->post['width'])) { // $this->data['width'] = $this->request->post['width']; // } elseif (!empty($product_info)) { // $this->data['width'] = $product_info['width']; // } else { // $this->data['width'] = ''; // } // // if (isset($this->request->post['height'])) { // $this->data['height'] = $this->request->post['height']; // } elseif (!empty($product_info)) { // $this->data['height'] = $product_info['height']; // } else { // $this->data['height'] = ''; // } // $this->getLoader()->model('localisation/length_class'); $this->data['length_classes'] = MeasureUnitDAO::getInstance()->getLengthClasses(); // if (isset($this->request->post['length_class_id'])) { // $this->data['length_class_id'] = $this->request->post['length_class_id']; // } elseif (!empty($product_info)) { // $this->data['length_class_id'] = $product_info['length_class_id']; // } else { // $this->data['length_class_id'] = $this->getConfig()->get('config_length_class_id'); // } // if (isset($this->request->post['product_attribute'])) { // $this->data['product_attributes'] = $this->request->post['product_attribute']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_attributes'] = ProductDAO::getInstance()->getProductAttributes($this->request->get['product_id']); // } else { // $this->data['product_attributes'] = array(); // } // $this->data['product_options'] = array(); // if (isset($this->request->post['product_option'])) { // $product_options = $this->request->post['product_option']; // $product_options = new ProductOptionCollection(); // foreach ($this->getRequest()->getParam('product_option') as $productOptionParam) { // $productOption = new ProductOption( // $productOptionParam['product_option_id'], // Produ // ) // } // } elseif (isset($this->request->get['product_id'])) { // $product_options = ProductDAO::getInstance()->getProductOptions($this->request->get['product_id']); // } else { // $product_options = []; // } // // // foreach ($product_options as $product_option) { // if ($product_option->getType() == 'select' || $product_option->getType() == 'radio' || $product_option->getType() == 'checkbox' || $product_option->getType() == 'image') { // $product_option_value_data = array(); // // foreach ($product_option->getValue() as $product_option_value) { // $product_option_value_data[] = array( // 'product_option_value_id' => $product_option_value->getId(), // 'option_value_id' => $product_option_value->getOptionValue()->getId(), // 'quantity' => $product_option_value->getQuantity(), // 'subtract' => $product_option_value->getSubtract(), // 'price' => $product_option_value->getPrice(), // 'price_prefix' => $product_option_value->getPrice() > 0 ? '+' : '-', // 'points' => $product_option_value->getPoints(), // 'points_prefix' => $product_option_value->getPoints() > 0 ? '+' : '-', // 'weight' => $product_option_value->getWeight(), // 'weight_prefix' => $product_option_value->getWeight() > 0 ? '+' : '-' // ); // } // // $this->data['product_options'][] = array( // 'product_option_id' => $product_option->getId(), // 'option_id' => $product_option->getOption()->getId(), // 'name' => $product_option->getOption()->getName(), // 'type' => $product_option->getType(), // 'product_option_value' => $product_option_value_data, // 'required' => $product_option->isRequired() // ); // } else { // $this->data['product_options'][] = array( // 'product_option_id' => $product_option->getId(), // 'option_id' => $product_option->getOption()->getId(), // 'name' => $product_option->getOption()->getName(), // 'type' => $product_option->getType(), // 'option_value' => $product_option->getValue(), // 'required' => $product_option->isRequired() // ); // } // } $this->data['create_option_block'] = $this->getOptionForm(); $this->data['customer_groups'] = $this->getLoader()->model('sale/customer_group')->getCustomerGroups(); // if (isset($this->request->post['product_discount'])) { // $this->data['product_discounts'] = $this->request->post['product_discount']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_discounts'] = ProductDAO::getInstance()->getProductDiscounts($this->request->get['product_id']); // } else { // $this->data['product_discounts'] = array(); // } // if (isset($this->request->post['product_special'])) { // $this->data['product_specials'] = $this->request->post['product_special']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_specials'] = ProductDAO::getInstance()->getProductSpecials($this->request->get['product_id']); // } else { // $this->data['product_specials'] = array(); // } // if (isset($this->request->post['product_image'])) { // $product_images = $this->request->post['product_image']; // } elseif (isset($this->request->get['product_id'])) { // $product_images = ProductDAO::getInstance()->getProductImages($this->request->get['product_id']); // } else { // $product_images = array(); // } $this->data['product_images'] = array(); foreach ($this->model->getImages() as $productImage) { if (file_exists(DIR_IMAGE . $productImage->getImagePath())) { $image = $productImage->getImagePath(); } else { $image = 'no_image.jpg'; } $this->data['product_images'][] = array('image' => $image, 'thumb' => ImageService::getInstance()->resize($image, 100, 100), 'sort_order' => $productImage->getSortOrder()); } $this->data['no_image'] = ImageService::getInstance()->resize('no_image.jpg', 100, 100); $this->data['downloads'] = $this->getLoader()->model('catalog/download')->getDownloads(); // if (isset($this->request->post['product_download'])) { // $this->data['product_download'] = $this->request->post['product_download']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_download'] = ProductDAO::getInstance()->getProductDownloads($this->request->get['product_id']); // } else { // $this->data['product_download'] = array(); // } $categories = CategoryDAO::getInstance()->getAllCategories(); $this->data['categories'] = $this->getAllCategories($categories); // if (isset($this->request->post['main_category_id'])) { // $this->data['main_category_id'] = $this->request->post['main_category_id']; // } elseif (isset($product_info)) { // $this->data['main_category_id'] = $this->model_catalog_product->getProductMainCategoryId($this->request->get['product_id']); // } else { // $this->data['main_category_id'] = 0; // } // if (isset($this->request->post['product_category'])) { // $this->data['product_category'] = $this->request->post['product_category']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_category'] = $this->model_catalog_product->getProductCategories($this->request->get['product_id']); // } else { // $this->data['product_category'] = array(); // } $this->data['categoriesParent'] = $this->getCategoriesParent(0, array_map(function (ProductCategory $item) { return $item->getCategory()->getId(); }, $this->model->getCategories())); // $this->data['scripts'] = '$("#navigation ul").treeview({persist: "location", collapsed: true, unique: true });'; // if (isset($this->request->post['product_related'])) { // $products = $this->request->post['product_related']; // } elseif (isset($this->request->get['product_id'])) { // $products = $this->model_catalog_product->getProductRelated($this->request->get['product_id']); // } else { // $products = array(); // } // // $this->data['product_related'] = array(); // // foreach ($products as $product_id) { // $related_info = $this->model_catalog_product->getProduct($product_id); // // if ($related_info) { // $this->data['product_related'][] = array( // 'product_id' => $related_info['product_id'], // 'name' => $related_info['name'] // ); // } // } // if (isset($this->request->post['points'])) { // $this->data['points'] = $this->request->post['points']; // } else if (!empty($product_info)) { // $this->data['points'] = $product_info['points']; // } else { // $this->data['points'] = ''; // } // if (isset($this->request->post['koreanName'])) { // $this->data['koreanName'] = $this->request->post['koreanName']; // } else if (!empty($product_info)) { // $this->data['koreanName'] = $product_info['korean_name']; // } else { // $this->data['koreanName'] = ''; // } // if (isset($this->request->post['supplierUrl'])) { // $this->data['supplierUrl'] = $this->request->post['supplierUrl']; // } else if (!empty($product_info)) { // $this->data['supplierUrl'] = $product_info['supplier_url']; // } else { // $this->data['supplierUrl'] = ''; // } // if (isset($this->request->post['product_reward'])) { // $this->data['product_reward'] = $this->request->post['product_reward']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_reward'] = $this->model_catalog_product->getProductRewards($this->request->get['product_id']); // } else { // $this->data['product_reward'] = array(); // } // if (isset($this->request->post['product_layout'])) { // $this->data['product_layout'] = $this->request->post['product_layout']; // } elseif (isset($this->request->get['product_id'])) { // $this->data['product_layout'] = $this->model_catalog_product->getProductLayouts($this->request->get['product_id']); // } else { // $this->data['product_layout'] = array(); // } $this->data['layouts'] = $this->getLoader()->model('design/layout')->getLayouts(); $this->children = array('common/header', 'common/footer'); $this->getResponse()->setOutput($this->render('catalog/productForm.tpl.php')); }
/** * */ public function index() { $this->language->load('product/product'); if (isset($this->request->get['path'])) { $path = ''; foreach (explode('_', $this->request->get['path']) as $path_id) { if (!$path) { $path = $path_id; } else { $path .= '_' . $path_id; } $category = CategoryDAO::getInstance()->getCategory($path_id); if ($category) { #kabantejay synonymizer start $razdel = $category->getDescription()->getName(); #kabantejay synonymizer end $this->setBreadcrumbs([['text' => $category->getDescription()->getName(), 'route' => 'product/category&path=' . $path]]); } } } if (isset($this->request->get['manufacturer_id'])) { $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->getUrl()->link('product/manufacturer'), 'separator' => $this->language->get('text_separator')); $manufacturer_info = ManufacturerDAO::getInstance()->getManufacturer($this->request->get['manufacturer_id']); if ($manufacturer_info) { $this->data['breadcrumbs'][] = array('text' => $manufacturer_info['name'], 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id']), 'separator' => $this->language->get('text_separator')); } } if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_tag'])) { $url = ''; if (isset($this->request->get['filter_name'])) { $url .= '&filter_name=' . $this->request->get['filter_name']; } if (isset($this->request->get['filter_tag'])) { $url .= '&filter_tag=' . $this->request->get['filter_tag']; } if (isset($this->request->get['filter_description'])) { $url .= '&filter_description=' . $this->request->get['filter_description']; } if (isset($this->request->get['filter_category_id'])) { $url .= '&filter_category_id=' . $this->request->get['filter_category_id']; } $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_search'), 'href' => $this->getUrl()->link('product/search', $url), 'separator' => $this->language->get('text_separator')); } if (isset($this->request->get['product_id'])) { $productId = $this->request->get['product_id']; } else { $productId = 0; } try { $product = ProductDAO::getInstance()->getProduct($productId, false, true); $description = is_null($product->getDescription($this->getLanguage()->getId())) ? new \model\localization\Description($this->getLanguage()->getId(), '') : $product->getDescription($this->getLanguage()->getId()); $this->data['product_info'] = $product; //print_r($product_info);exit; $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['manufacturer_id'])) { $url .= '&manufacturer_id=' . $this->request->get['manufacturer_id']; } if (isset($this->request->get['filter_name'])) { $url .= '&filter_name=' . $this->request->get['filter_name']; } if (isset($this->request->get['filter_tag'])) { $url .= '&filter_tag=' . $this->request->get['filter_tag']; } if (isset($this->request->get['filter_description'])) { $url .= '&filter_description=' . $this->request->get['filter_description']; } if (isset($this->request->get['filter_category_id'])) { $url .= '&filter_category_id=' . $this->request->get['filter_category_id']; } $this->data['breadcrumbs'][] = array('text' => $product->getName(), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $this->request->get['product_id']), 'separator' => $this->language->get('text_separator')); if (!empty($description->getSeoTitle())) { $this->document->setTitle($description->getSeoTitle()); } else { $this->document->setTitle($product->getName()); } $this->document->setDescription($description->getMetaDescription()); $this->document->setKeywords($description->getMetaKeyword()); //$this->document->addLink($this->getUrl()->link('product/product', 'product_id=' . $this->request->get['product_id']), 'canonical'); $this->data['seo_h1'] = $description->getSeoH1(); $this->data['heading_title'] = $product->getName(); $this->data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product->getMinimum()); $this->getLoader()->model('catalog/review'); $this->data['tab_review'] = sprintf($this->language->get('tab_review'), $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id'])); $this->data['product_id'] = $product->getId(); $this->data['manufacturer'] = $product->getManufacturer()->getName(); $this->data['manufacturers'] = $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $product->getManufacturer()->getId()); $this->data['model'] = $product->getModel(); $this->data['reward'] = $product->getRewards(); $this->data['points'] = $product->getPoints(); if ($product->getQuantity() <= 0) { $this->data['stock'] = $product->getStockStatusId(); } elseif ($this->getConfig()->get('config_stock_display')) { $this->data['stock'] = $product->getQuantity(); } else { $this->data['stock'] = $this->language->get('text_instock'); } if ($product->getImagePath()) { $this->data['popup'] = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_popup_width'), $this->getConfig()->get('config_image_popup_height')); } else { $this->data['popup'] = ''; } $results = ProductDAO::getInstance()->getProductImages($this->request->get['product_id']); if ($results) { $this->data['thumb'] = ImageService::getInstance()->resize($results[0]->getImagePath(), $this->getConfig()->get('config_image_thumb_width'), $this->getConfig()->get('config_image_thumb_height')); } else { if ($product->getImagePath()) { $this->data['thumb'] = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_thumb_width'), $this->getConfig()->get('config_image_thumb_height')); } else { $this->data['thumb'] = ''; } } $this->data['images'] = array(); foreach ($results as $tag) { $this->data['images'][] = array('popup' => ImageService::getInstance()->resize($tag->getImagePath(), $this->getConfig()->get('config_image_popup_width'), $this->getConfig()->get('config_image_popup_height')), 'thumb' => ImageService::getInstance()->resize($tag->getImagePath(), $this->getConfig()->get('config_image_additional_width'), $this->getConfig()->get('config_image_additional_height'))); } if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) { $this->data['price'] = $this->getCurrentCurrency()->format($product->getPrice()); } else { $this->data['price'] = false; } if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) { $this->data['special'] = $this->getCurrentCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())); } else { $this->data['special'] = false; } // if ($this->getConfig()->get('config_tax')) { // $this->data['tax'] = $this->getCurrentCurrency()->format((float)$product_info->getSpecial'] ? $product_info['special'] : $product_info['price()); // } else { // $this->data['tax'] = false; // } $discounts = ProductDAO::getInstance()->getProductDiscounts($product->getId()); $this->data['discounts'] = array(); foreach ($discounts as $discount) { $this->data['discounts'][] = array('quantity' => $discount['quantity'], 'price' => $this->getCurrentCurrency()->format($discount['price'])); } $this->data['options'] = array(); foreach (ProductDAO::getInstance()->getProductOptions($this->request->get['product_id']) as $productOption) { if ($productOption->getOption()->isMultiValueType()) { $option_value_data = array(); foreach ($productOption->getValue() as $option_value) { if (is_null($option_value->getOptionValue())) { continue; } if (!$option_value->getSubtract() || $option_value->getQuantity() > 0) { $option_value_data[] = array('product_option_value_id' => $option_value->getId(), 'option_value_id' => $option_value->getOptionValue()->getId(), 'name' => $option_value->getOptionValue()->getName(), 'image' => ImageService::getInstance()->resize($option_value->getOptionValue()->getImage(), 50, 50), 'price' => (double) $option_value->getPrice() ? $this->getCurrentCurrency()->format($option_value->getPrice()) : false, 'price_prefix' => $option_value->getPrice() < 0 ? '-' : '+'); } } $this->data['options'][] = array('product_option_id' => $productOption->getId(), 'option_id' => $productOption->getOption()->getId(), 'name' => $productOption->getOption()->getName(), 'type' => $productOption->getType(), 'option_value' => $option_value_data, 'required' => $productOption->isRequired()); } elseif ($productOption->getOption()->isSingleValueType()) { $this->data['options'][] = array('product_option_id' => $productOption->getId(), 'option_id' => $productOption->getOption()->getId(), 'name' => $productOption->getOption()->getName(), 'type' => $productOption->getType(), 'option_value' => $productOption->getValue(), 'required' => $productOption->isRequired()); } } if ($product->getMinimum()) { $this->data['minimum'] = $product->getMinimum(); } else { $this->data['minimum'] = 1; } $date_added = getdate(strtotime($product->getDateAdded())); $date_added = mktime(0, 0, 0, $date_added['mon'], $date_added['mday'], $date_added['year']); $this->data['review_status'] = $this->getConfig()->get('config_review_status'); $this->data['reviews'] = sprintf($this->language->get('text_reviews'), (int) $product->getReviewsCount()); $this->data['rating'] = (int) $product->getRating(); $this->data['description'] = html_entity_decode($description->getDescription(), ENT_QUOTES, 'UTF-8'); $this->data['image_description'] = html_entity_decode($product->getImageDescription(), ENT_QUOTES, 'UTF-8'); $this->data['attribute_groups'] = $product->getAttributes(); $this->data['hot'] = $date_added + 86400 * $this->getConfig()->get('config_product_hotness_age') > time(); $this->data['weight'] = $this->weight->format($product->getWeight()->getWeight(), $product->getWeight()->getUnit()->getId()); $this->data['products'] = array(); #kabantejay synonymizer start if (!is_null($product->getManufacturer())) { $brand = ''; } else { $brand = $product->getManufacturer(); } if (!isset($razdel)) { $razdel = ''; } if (!isset($category)) { $syncat = ''; } else { $syncat = $category->getDescription()->getName(); } if (!is_null($product->getModel())) { $synmod = ''; } else { $synmod = $product->getModel(); } if ($this->data['special'] == false) { $synprice = $this->data['price']; } else { $synprice = $this->data['special']; } $syntext = array(array("%H1%", $product->getName()), array("%BRAND%", $brand), array("%RAZDEL%", $razdel), array("%CATEGORY%", $syncat), array("%MODEL%", $synmod), array("%PRICE%", $synprice)); for ($it = 0; $it < 6; $it++) { $this->data['description'] = str_replace($syntext[$it][0], $syntext[$it][1], $this->data['description']); } $this->data['description'] = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) { $ar = explode("|", $m[1]); return $ar[array_rand($ar, 1)]; }, $this->data['description']); #kabantejay synonymizer end // $results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']); // $results = $product_info->getRelated(); foreach ($product->getRelated() as $tag) { if ($tag->getImagePath()) { $image = ImageService::getInstance()->resize($tag->getImagePath(), $this->getConfig()->get('config_image_related_width'), $this->getConfig()->get('config_image_related_height')); } else { $image = false; } if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) { $price = $this->getCurrentCurrency()->format($tag->getPrice()); } else { $price = false; } if ((double) $tag->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) { $special = $this->getCurrentCurrency()->format($tag->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())); } else { $special = false; } if ($this->getConfig()->get('config_review_status')) { $rating = (int) $tag->getRating(); } else { $rating = false; } $this->data['products'][] = array('product_id' => $tag->getId(), 'thumb' => $image, 'name' => $tag->getName(), 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $tag->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', 'product_id=' . $tag->getId())); } $this->data['tags'] = array(); // $results = $this->model_catalog_product->getProductTags($this->request->get['product_id']); foreach ($product->getTags() as $tag) { $this->data['tags'][] = array('tag' => $tag, 'href' => $this->getUrl()->link('product/search', 'filter_tag=' . $tag)); } ProductDAO::getInstance()->updateViewed($product->getId()); $this->setBreadcrumbs(); $this->children = array('common/header', 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer'); $templateFile = '/template/product/product.tpl'; $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : 'default'; $this->getResponse()->setOutput($this->render($templateDir . $templateFile)); } catch (InvalidArgumentException $exc) { $url = ''; if (isset($this->request->get['path'])) { $url .= '&path=' . $this->request->get['path']; } if (isset($this->request->get['manufacturer_id'])) { $url .= '&manufacturer_id=' . $this->request->get['manufacturer_id']; } if (isset($this->request->get['filter_name'])) { $url .= '&filter_name=' . $this->request->get['filter_name']; } if (isset($this->request->get['filter_tag'])) { $url .= '&filter_tag=' . $this->request->get['filter_tag']; } if (isset($this->request->get['filter_description'])) { $url .= '&filter_description=' . $this->request->get['filter_description']; } if (isset($this->request->get['filter_category_id'])) { $url .= '&filter_category_id=' . $this->request->get['filter_category_id']; } $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_error'), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $productId), 'separator' => $this->language->get('text_separator')); $this->document->setTitle($this->language->get('text_error')); $this->data['heading_title'] = $this->language->get('text_error'); $this->data['text_error'] = $this->language->get('text_error'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['continue'] = $this->getUrl()->link('common/home'); $this->children = array('common/header', 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer'); $this->getResponse()->setOutput($this->render($this->getConfig()->get('config_template') . '/template/error/not_found.tpl')); } }
public function product() { $manufacturer = ManufacturerDAO::getInstance()->getManufacturer($this->parameters['manufacturerId']); if ($manufacturer) { if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getSeoTitle())) { $this->document->setTitle($manufacturer->getDescription($this->getLanguage()->getId())->getSeoTitle()); } else { $this->document->setTitle($manufacturer->getName()); } if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getMetaDescription())) { $this->document->setDescription($manufacturer->getDescription($this->getLanguage()->getId())->getMetaDescription()); } if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getMetaKeyword())) { $this->document->setKeywords($manufacturer->getDescription($this->getLanguage()->getId())->getMetaKeyword()); } if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getSeoH1())) { $this->data['seo_h1'] = $manufacturer->getDescription($this->getLanguage()->getId())->getSeoH1(); } $this->data = array_merge($this->data, $this->parameters); $this->data['heading_title'] = $manufacturer->getName(); $this->data['compare'] = $this->getUrl()->link('product/compare'); $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } #kabantejay synonymizer start $this->data['description'] = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) { $ar = explode("|", $m[1]); return $ar[array_rand($ar, 1)]; }, html_entity_decode(!is_null($manufacturer->getDescription($this->getLanguage()->getId())) ? $manufacturer->getDescription($this->getLanguage()->getId())->getDescription() : "", ENT_QUOTES, 'UTF-8')); #kabantejay synonymizer end $this->data['products'] = array(); $data = array('filterManufacturerId' => $this->parameters['manufacturerId'], 'sort' => $this->parameters['sort'], 'order' => $this->parameters['order'], 'start' => ($this->parameters['page'] - 1) * $this->parameters['limit'], 'limit' => $this->parameters['limit']); $product_total = ProductDAO::getInstance()->getProductsCount($data); $products = ProductDAO::getInstance()->getProducts($data, $this->parameters['sort'], $this->parameters['order'], ($this->parameters['page'] - 1) * $this->parameters['limit'], $this->parameters['limit']); foreach ($products as $product) { if ($product->getImagePath()) { $image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height')); } else { $image = false; } if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) { // $price = $this->currency->format($this->tax->calculate($product->getPrice(), $product->getTaxClassId(), $this->getConfig()->get('config_tax'))); $price = $this->getCurrentCurrency()->format($product->getPrice()); } else { $price = false; } if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) { // $special = $this->currency->format($this->tax->calculate($product->getSpecials(), $product->getTaxClassId(), $this->getConfig()->get('config_tax'))); $special = $this->getCurrentCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())); } else { $special = false; } // if ($this->getConfig()->get('config_tax')) { // $tax = $this->currency->format((float)$product->getSpecial() ? $product->getSpecial() : $product->getPrice()); // } else { // $tax = false; // } // #kabantejay synonymizer start if (is_null($product->getDescriptions())) { $description = ''; } else { $description = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) { $ar = explode("|", $m[1]); return $ar[array_rand($ar, 1)]; }, $product->getDescriptions()->getDescription($this->getLanguage()->getId())); } // #kabantejay synonymizer end $this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => utf8_truncate(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')), 400, ' …', true), 'price' => $price, 'special' => $special, 'rating' => $this->getConfig()->get('config_review_status') ? $product->getRating() : false, 'reviews' => sprintf($this->getLanguage()->get('text_reviews'), $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&manufacturer_id=' . $product->getManufacturer()->getId() . '&product_id=' . $product->getId())); } $url = ''; if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $this->data['sorts'] = array(); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.sort_order&order=ASC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=pd.name&order=ASC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=pd.name&order=DESC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.price&order=ASC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.price&order=DESC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=rating&order=DESC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=rating&order=ASC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.model&order=ASC' . $url)); $this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.model&order=DESC' . $url)); $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $this->data['limits'] = array(); $this->data['limits'][] = array('text' => $this->getConfig()->get('config_catalog_limit'), 'value' => $this->getConfig()->get('config_catalog_limit'), 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=' . $this->getConfig()->get('config_catalog_limit'))); $this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=25')); $this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=50')); $this->data['limits'][] = array('text' => 75, 'value' => 75, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=75')); $this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&limit=100')); $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $this->setBreadcrumbs([['text' => $this->getLanguage()->get('text_brand'), 'route' => $this->getUrl()->link('product/manufacturer')]]); $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $this->parameters['page']; $pagination->limit = $this->parameters['limit']; $pagination->text = $this->getLanguage()->get('text_pagination'); $pagination->url = $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url . '&page={page}'); $this->data['pagination'] = $pagination->render(); $this->data['continue'] = $this->getUrl()->link('common/home'); $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header'); $templateFile = '/template/product/manufacturerInfo.tpl.php'; $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : 'default'; $this->getResponse()->setOutput($this->render($templateDir . $templateFile)); } else { $this->document->setTitle($this->getLanguage()->get('text_error')); $this->data['heading_title'] = $this->getLanguage()->get('text_error'); $this->data['continue'] = $this->getUrl()->link('common/home'); $this->setBreadcrumbs(); $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header'); $templateFile = '/template/error/not_found.tpl'; $templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : 'default'; $this->getResponse()->setOutput($this->render($templateDir . $templateFile)); } }
/** * @param $id * @param int $defaultLanguageId * @param int $afcId * @param mixed $affiliateCommission * @param string $dateAdded * @param string $dateAvailable * @param string $dateModified * @param DescriptionCollection $description * @param Dimensions $dimension * @param string $imagePath * @param string $keyword * @param string $koreanName * @param string $location * @param int $manufacturerId * @param float $minimum * @param string $model * @param ProductOption[] $productOptions * @param int $points * @param float $price * @param int $quantity * @param float $shipping * @param mixed $sku * @param int $sortOrder * @param mixed $status * @param int $stockStatusId * @param int[] $stores * @param int $subtract * @param Supplier $supplier * @param string $supplierUrl * @param array $tag * @param mixed $upc * @param int $userId * @param int $viewed * @param Weight $weight * @param array $attributes * @param array $discounts * @param array $specials * @param array $downloads * @param ProductCategory[] $categories * @param Product[]|int[] $related * @param array $layouts * @param array $rewards * @param string $imageDescription * @param Auction[] $auctions */ public function __construct($id, $defaultLanguageId, $afcId = null, $affiliateCommission = null, $dateAdded = null, $dateAvailable = null, $dateModified = null, $description = null, $dimension = null, $imagePath = null, $keyword = null, $koreanName = null, $location = null, $manufacturerId = null, $minimum = null, $model = null, $productOptions = null, $points = null, $price = null, $quantity = null, $shipping = null, $sku = null, $sortOrder = null, $status = null, $stockStatusId = null, $stores = null, $subtract = null, $supplier = null, $supplierUrl = null, $tag = null, $upc = null, $userId = null, $viewed = null, $weight = null, $attributes = null, $discounts = null, $specials = null, $downloads = null, $categories = null, $related = null, $layouts = null, $rewards = null, $imageDescription = null, $auctions = null) { $this->id = $id; $this->saved = $this->id != 0; if (!is_null($afcId)) { $this->afcId = $afcId; } if (!is_null($affiliateCommission)) { $this->affiliateCommission = $affiliateCommission; } if (!is_null($attributes)) { $this->attributes = new Mutable($attributes); } if (!is_null($auctions)) { $this->auctions = new Mutable($auctions); } if (!is_null($categories)) { $this->categories = new Mutable($categories); } if (!is_null($dateAdded)) { $this->dateAdded = $dateAdded; } if (!is_null($dateAvailable)) { $this->dateAvailable = $dateAvailable; } if (!is_null($dateModified)) { $this->dateModified = $dateModified; } $this->defaultLanguageId = $defaultLanguageId; if (!is_null($description)) { $this->description = new Mutable($description); } if (!is_null($dimension)) { $this->dimension = $dimension; } if (!is_null($discounts)) { $this->discounts = new Mutable($discounts); } if (!is_null($downloads)) { $this->downloads = new Mutable($downloads); } if (!is_null($imageDescription)) { $this->imageDescription = $imageDescription; } if (!is_null($imagePath)) { $this->imagePath = $imagePath; } if (!is_null($keyword)) { $this->keyword = $keyword; } if (!is_null($koreanName)) { $this->koreanName = $koreanName; } if (!is_null($location)) { $this->location = $location; } if (!is_null($manufacturerId)) { $this->manufacturer = ManufacturerDAO::getInstance()->getManufacturer($manufacturerId); } if (!is_null($minimum)) { $this->minimum = $minimum; } if (!is_null($model)) { $this->model = $model; } if (!is_null($productOptions)) { $tempProductOptions = new ProductOptionCollection(); foreach ($productOptions as $option) { $tempProductOptions->attach($option); } $this->productOptions = new Mutable($tempProductOptions); } if (!is_null($points)) { $this->points = $points; } if (!is_null($price)) { $this->price = $price; } if (!is_null($quantity)) { $this->quantity = $quantity; } if (!is_null($related) && is_array($related)) { if ($related[0] instanceof Product) { $this->related = new Mutable($related); } else { $relatedProducts = []; foreach ($related as $relatedProductId) { $relatedProducts[] = new Product($relatedProductId, $defaultLanguageId); } $this->related = new Mutable($relatedProducts); } } if (!is_null($rewards)) { $this->rewards = new Mutable($rewards); } if (!is_null($shipping)) { $this->shipping = $shipping; } if (!is_null($sku)) { $this->sku = $sku; } if (!is_null($sortOrder)) { $this->sortOrder = $sortOrder; } if (!is_null($specials)) { $this->specials = new Mutable($specials); } if (!is_null($status)) { $this->status = $status; } if (!is_null($stockStatusId)) { $this->stockStatusId = $stockStatusId; } if (!is_null($stores)) { $this->stores = new Mutable($stores); } if (!is_null($subtract)) { $this->subtract = $subtract; } if (!is_null($supplier)) { $this->supplier = $supplier; } if (!is_null($supplierUrl)) { $this->supplierUrl = $supplierUrl; } if (!is_null($tag)) { $this->tags = new Mutable($tag); } if (!is_null($upc)) { $this->upc = $upc; } if (!is_null($userId)) { $this->userId = $userId; } if (!is_null($viewed)) { $this->viewed = $viewed; } if (!is_null($weight)) { $this->weight = $weight; } }
/** * @param $supplierId * @return Manufacturer */ public function getRelatedManufacturer($supplierId) { $relatedManufacturerId = $this->getDb()->queryScalar("\n SELECT manufacturer_id\n FROM supplier_to_manufacturer\n WHERE supplier_id = ?\n ", array("i:{$supplierId}")); return ManufacturerDAO::getInstance()->getManufacturer($relatedManufacturerId, true); }
public function index() { $this->load->language('module/mpchanges'); $this->load->model('catalog/category'); $this->load->model('setting/store'); $this->load->model('sale/customer_group'); $this->setBreadcrumbs([['text' => $this->language->get('text_module'), 'route' => 'extension/module']]); if (isset($this->error['warning'])) { $this->data['error_warning'] = $this->error['warning']; } else { $this->data['error_warning'] = ''; } $this->document->setTitle($this->language->get('heading_title')); $this->data['token'] = $this->session->data['token']; $this->data['url_cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'); $this->data['action_change_price'] = $this->url->link('module/mpchanges/changeprice', 'token=' . $this->session->data['token'], 'SSL'); $this->data['action_change_specials'] = $this->url->link('module/mpchanges/changespecial', 'token=' . $this->session->data['token'], 'SSL'); $this->data['action_save_specials'] = $this->url->link('module/mpchanges/addspecial', 'token=' . $this->session->data['token'], 'SSL'); $this->data['action_change_discounts'] = $this->url->link('module/mpchanges/changediscounts', 'token=' . $this->session->data['token'], 'SSL'); $this->data['action_save_discounts'] = $this->url->link('module/mpchanges/adddiscounts', 'token=' . $this->session->data['token'], 'SSL'); $this->data['action_del_elements'] = $this->url->link('module/mpchanges/delelements', 'token=' . $this->session->data['token'], 'SSL'); $this->data['urlGetOptionValues'] = $this->url->link('module/mpchanges/getOptionValues', 'token=' . $this->session->data['token'], 'SSL'); $this->data['urlGetProgress'] = $this->url->link('module/mpchanges/getProgress', 'token=' . $this->session->data['token'], 'SSL'); $this->data['urlSetOption'] = $this->url->link('module/mpchanges/setOption', 'token=' . $this->session->data['token'], 'SSL'); $this->data['customer_groups'] = $this->model_sale_customer_group->getCustomerGroups(); $this->data['manufacturers'] = ManufacturerDAO::getInstance()->getManufacturers(); $this->data['suppliers'] = SupplierDAO::getInstance()->getSuppliers(); $this->data['categories'] = $this->model_catalog_category->getCategories(); $this->data['options'] = OptionDAO::getInstance()->getOptions(); $this->children = array('common/header', 'common/footer'); $this->getResponse()->setOutput($this->render('module/mpchanges.tpl.php')); }
private function getForm() { $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['text_enabled'] = $this->language->get('text_enabled'); $this->data['text_disabled'] = $this->language->get('text_disabled'); $this->data['text_default'] = $this->language->get('text_default'); $this->data['text_image_manager'] = $this->language->get('text_image_manager'); $this->data['text_browse'] = $this->language->get('text_browse'); $this->data['text_clear'] = $this->language->get('text_clear'); $this->data['text_percent'] = $this->language->get('text_percent'); $this->data['text_amount'] = $this->language->get('text_amount'); $this->data['entry_name'] = $this->language->get('entry_name'); $this->data['entry_store'] = $this->language->get('entry_store'); $this->data['entry_keyword'] = $this->language->get('entry_keyword'); $this->data['entry_image'] = $this->language->get('entry_image'); $this->data['entry_sort_order'] = $this->language->get('entry_sort_order'); $this->data['entry_customer_group'] = $this->language->get('entry_customer_group'); $this->data['entry_meta_keyword'] = $this->language->get('entry_meta_keyword'); $this->data['entry_meta_description'] = $this->language->get('entry_meta_description'); $this->data['entry_description'] = $this->language->get('entry_description'); $this->data['entry_seo_title'] = $this->language->get('entry_seo_title'); $this->data['entry_seo_h1'] = $this->language->get('entry_seo_h1'); $this->data['button_save'] = $this->language->get('button_save'); $this->data['button_cancel'] = $this->language->get('button_cancel'); $this->data['tab_general'] = $this->language->get('tab_general'); if (isset($this->error['warning'])) { $this->data['error_warning'] = $this->error['warning']; } else { $this->data['error_warning'] = ''; } if (isset($this->error['name'])) { $this->data['error_name'] = $this->error['name']; } else { $this->data['error_name'] = ''; } $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false); $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('catalog/manufacturer', 'token=' . $this->session->data['token'] . $url, 'SSL'), 'separator' => ' :: '); if (!isset($this->request->get['manufacturer_id'])) { $this->data['action'] = $this->url->link('catalog/manufacturer/insert', 'token=' . $this->session->data['token'] . $url, 'SSL'); } else { $this->data['action'] = $this->url->link('catalog/manufacturer/update', 'token=' . $this->session->data['token'] . '&manufacturer_id=' . $this->request->get['manufacturer_id'] . $url, 'SSL'); } $this->data['cancel'] = $this->url->link('catalog/manufacturer', 'token=' . $this->session->data['token'] . $url, 'SSL'); $this->data['token'] = $this->session->data['token']; if (isset($this->request->get['manufacturer_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') { $manufacturer_info = ManufacturerDAO::getInstance()->getManufacturer($this->request->get['manufacturer_id']); } $this->load->model('localisation/language'); $this->data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->post['manufacturer_description'])) { $this->data['manufacturer_description'] = $this->request->post['manufacturer_description']; } elseif (!empty($manufacturer_info)) { $this->data['manufacturer_description'] = ManufacturerDAO::getInstance()->getManufacturerDescriptions($this->request->get['manufacturer_id']); } else { $this->data['manufacturer_description'] = array(); } if (isset($this->request->post['name'])) { $this->data['name'] = $this->request->post['name']; } elseif (!empty($manufacturer_info)) { $this->data['name'] = $manufacturer_info['name']; } else { $this->data['name'] = ''; } $this->load->model('setting/store'); $this->data['stores'] = $this->model_setting_store->getStores(); if (isset($this->request->post['manufacturer_store'])) { $this->data['manufacturer_store'] = $this->request->post['manufacturer_store']; } elseif (isset($this->request->get['manufacturer_id'])) { $this->data['manufacturer_store'] = ManufacturerDAO::getInstance()->getManufacturerStores($this->request->get['manufacturer_id']); } else { $this->data['manufacturer_store'] = array(0); } if (isset($this->request->post['keyword'])) { $this->data['keyword'] = $this->request->post['keyword']; } elseif (!empty($manufacturer_info)) { $this->data['keyword'] = $manufacturer_info['keyword']; } else { $this->data['keyword'] = ''; } if (isset($this->request->post['image'])) { $this->data['image'] = $this->request->post['image']; } elseif (!empty($manufacturer_info)) { $this->data['image'] = $manufacturer_info['image']; } else { $this->data['image'] = ''; } $this->load->model('tool/image'); if (!empty($manufacturer_info) && $manufacturer_info['image'] && file_exists(DIR_IMAGE . $manufacturer_info['image'])) { $this->data['thumb'] = $this->model_tool_image->resize($manufacturer_info['image'], 100, 100); } else { $this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 100, 100); } $this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100); if (isset($this->request->post['sort_order'])) { $this->data['sort_order'] = $this->request->post['sort_order']; } elseif (!empty($manufacturer_info)) { $this->data['sort_order'] = $manufacturer_info['sort_order']; } else { $this->data['sort_order'] = ''; } $this->template = 'catalog/manufacturer_form.tpl'; $this->children = array('common/header', 'common/footer'); $this->getResponse()->setOutput($this->render()); }
/** * @return ImportSourceSite[] */ public function getSourceSites() { $query = $this->getDb()->query("SELECT * FROM imported_source_sites"); $result = array(); foreach ($query->rows as $siteEntry) { $result[] = new ImportSourceSite($siteEntry['class_name'], null, preg_split('/,/', $siteEntry['default_category_id']), ManufacturerDAO::getInstance()->getManufacturer($siteEntry['default_manufacturer_id'], true), SupplierDAO::getInstance()->getSupplier($siteEntry['default_supplier_id'], true), $siteEntry['import_mapped_categories_only'], $siteEntry['name'], $siteEntry['regular_customer_price_rate'], preg_split('/,/', $siteEntry['default_store_id']), $siteEntry['wholesale_customer_price_rate'], $siteEntry['default_weight']); } return $result; }
/** * @param int $productId * @return Manufacturer */ public function getManufacturer($productId) { return ManufacturerDAO::getInstance()->getManufacturer($this->getSingleValue($productId, 'manufacturer_id')); }
/** * @return Mutable */ public function getStores() { if (!isset($this->stores)) { $this->stores = new Mutable(ManufacturerDAO::getInstance()->getManufacturerStores($this->id)); } return $this->stores->get(); }
/** * @param Supplier $supplier * @throws Exception */ private function getForm($supplier) { $this->data['text_amount'] = $this->language->get('text_amount'); $this->data['text_enabled'] = $this->language->get('text_enabled'); $this->data['text_disabled'] = $this->language->get('text_disabled'); $this->data['text_default'] = $this->language->get('text_default'); $this->data['text_image_manager'] = $this->language->get('text_image_manager'); $this->data['text_browse'] = $this->language->get('text_browse'); $this->data['text_clear'] = $this->language->get('text_clear'); $this->data['text_none'] = $this->language->get('text_none'); $this->data['text_percent'] = $this->language->get('text_percent'); $this->data['textFreeShippingThreshold'] = $this->language->get('FREE_SHIPPING_THRESHOLD'); $this->data['textRelatedManufacturer'] = $this->language->get('MANUFACTURER'); $this->data['textShippingCost'] = $this->language->get('textShippingCost'); $this->data['entry_name'] = $this->language->get('field_name') . ':'; $this->data['entry_supplier_group'] = $this->language->get('field_supplier_group') . ':'; $this->data['entry_internal_model'] = $this->language->get('field_internal_model') . ':'; $this->data['button_save'] = $this->language->get('button_save'); $this->data['button_cancel'] = $this->language->get('button_cancel'); $this->data['tab_general'] = $this->language->get('tab_general'); if (isset($this->error['warning'])) { $this->data['error_warning'] = $this->error['warning']; } else { $this->data['error_warning'] = ''; } foreach ($this->error as $key => $value) { $this->data["error_{$key}"] = $value; } $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false); $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('catalog/supplier', 'token=' . $this->session->data['token'] . $url, 'SSL'), 'separator' => ' :: '); if (!$supplier->getId()) { $this->data['action'] = $this->url->link('catalog/supplier/insert', 'token=' . $this->session->data['token'] . $url, 'SSL'); } else { $this->data['action'] = $this->url->link('catalog/supplier/update', 'token=' . $this->session->data['token'] . '&supplierId=' . $supplier->getId() . $url, 'SSL'); } $this->data['cancel'] = $this->url->link('catalog/supplier', 'token=' . $this->session->data['token'] . $url, 'SSL'); $this->data['token'] = $this->session->data['token']; // if (isset($this->request->get['supplierId']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { // $supplier = SupplierDAO::getInstance()->getSupplier($this->request->get['supplierId']); // } else { // $supplier = null; // } $this->load->model('localisation/language'); $this->data['languages'] = $this->model_localisation_language->getLanguages(); $this->data['supplier_groups'] = SupplierGroupDAO::getInstance()->getSupplierGroups(); $this->data['manufacturers'] = ManufacturerDAO::getInstance()->getManufacturers(); $this->data = array_merge($this->data, $this->parameters); $this->data['freeShippingThreshold'] = $supplier->getFreeShippingThreshold(); $this->data['internalModel'] = $supplier->getInternalModel(); $this->data['name'] = $supplier->getName(); $this->data['relatedManufacturerId'] = $supplier->getRelatedManufacturer()->getId(); $this->data['supplierGroupId'] = $supplier->getGroupId(); $this->data['shippingCost'] = $supplier->getShippingCost(); $this->template = 'catalog/supplierForm.tpl.php'; $this->children = array('common/header', 'common/footer'); $this->getResponse()->setOutput($this->render()); }