• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ProductSale类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty, $category_path;
     $category_path_ids = array();
     foreach ($category_path as $cat) {
         $category_path_ids[] = $cat['id_category'];
     }
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 25);
     $best_sellers = array();
     $nr = 0;
     foreach ($bestsellers as $bestseller) {
         if ($nr >= 5) {
             break;
         }
         $display = false;
         foreach (Product::getIndexedCategories($bestseller['id_product']) as $row) {
             if (in_array($row['id_category'], $category_path_ids)) {
                 $display = true;
                 break;
             }
         }
         if ($display) {
             $bestseller['price'] = Tools::displayPrice(Product::getPriceStaticLC(intval($bestseller['id_product'])), $currency, false, false);
             $best_sellers[] = $bestseller;
             $nr += 1;
         }
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), 'static_token' => Tools::getToken(false)));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:redb,项目名称:prestashop,代码行数:31,代码来源:blockbestsellers.php


示例2: process

 public function process()
 {
     $this->productSort();
     $nbProducts = (int) ProductSale::getNbSales();
     $this->pagination($nbProducts);
     self::$smarty->assign(array('products' => ProductSale::getBestSales((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:7,代码来源:BestSalesController.php


示例3: renderContent

 public function renderContent($setting)
 {
     $t = array('list_type' => '', 'limit' => 12, 'image_width' => '200', 'image_height' => '200');
     $products = array();
     $setting = array_merge($t, $setting);
     switch ($setting['list_type']) {
         case 'newest':
             $products = Product::getNewProducts($this->lang_id, 0, (int) $setting['limit']);
             break;
         case 'featured':
             $category = new Category(Context::getContext()->shop->getCategory(), $this->lang_id);
             $nb = (int) $setting['limit'];
             $products = $category->getProducts((int) $this->lang_id, 1, $nb ? $nb : 8);
             break;
         case 'bestseller':
             $products = ProductSale::getBestSalesLight((int) $this->lang_id, 0, (int) $setting['limit']);
             break;
         case 'special':
             $products = Product::getPricesDrop($this->lang_id, 0, (int) $setting['limit']);
             break;
     }
     $setting['products'] = $products;
     $output = array('type' => 'productlist', 'data' => $setting);
     return $output;
 }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:25,代码来源:productlist.php


示例4: initContent

 public function initContent()
 {
     if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
         parent::initContent();
         $this->productSort();
         $nb_products = (int) ProductSale::getNbSales();
         $this->pagination($nb_products);
         if (!Tools::getValue('orderby')) {
             $this->orderBy = 'sales';
         }
         $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
         $this->addColorsToProductList($products);
         /************************* /Images Array ******************************/
         if (method_exists('Product', 'getProductsImgs')) {
             $image_array = array();
             for ($i = 0; $i < $nb_products; $i++) {
                 if (isset($products[$i]['id_product'])) {
                     $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
                 }
             }
             $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
         }
         /************************* /Images Array ******************************/
         $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
         $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:29,代码来源:BestSalesController.php


示例5: initContent

 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     $nbProducts = (int) ProductSale::getNbSales();
     $this->pagination($nbProducts);
     $this->context->smarty->assign(array('products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home_default'), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:9,代码来源:BestSalesController.php


示例6: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty;
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 5);
     $best_sellers = array();
     foreach ($bestsellers as $bestseller) {
         $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
         $best_sellers[] = $bestseller;
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:sealence,项目名称:local,代码行数:13,代码来源:blockbestsellers.php


示例7: getBestSellers

 protected function getBestSellers($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return false;
     }
     if (!($result = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, 3))) {
         return Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false;
     }
     $currency = new Currency($params['cookie']->id_currency);
     $usetax = Product::getTaxCalculationMethod((int) $this->context->customer->id) != PS_TAX_EXC;
     foreach ($result as &$row) {
         $row['price'] = Tools::displayPrice(Product::getPriceStatic((int) $row['id_product'], $usetax), $currency);
     }
     return $result;
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:15,代码来源:blockbestsellers.php


示例8: initContent

 public function initContent()
 {
     if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
         parent::initContent();
         $this->productSort();
         $nbProducts = (int) ProductSale::getNbSales();
         $this->pagination($nbProducts);
         $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
         $this->addColorsToProductList($products);
         $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
         $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
开发者ID:carloslastresDev,项目名称:HealthyTaiwan_UsingPrestaShop,代码行数:15,代码来源:BestSalesController.php


示例9: renderContent

 public function renderContent($args, $setting)
 {
     # validate module
     unset($args);
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $nb = $setting['itemstab'] ? (int) $setting['itemstab'] : 8;
     $orderby = $setting['orderby'] ? $setting['orderby'] : 'date_add';
     $orderway = $setting['orderway'] ? $setting['orderway'] : 'date_add';
     $items_page = $columns_page = 3;
     if (isset($setting['itemspage']) && $setting['itemspage']) {
         $items_page = $setting['itemspage'];
     }
     if (isset($setting['columns']) && $setting['columns']) {
         $columns_page = $setting['columns'];
     }
     $interval = isset($setting['interval']) ? (int) $setting['interval'] : 8000;
     switch ($setting['specialtype']) {
         case 'newest':
             $products = Product::getNewProducts($this->langID, 0, $nb, false, $orderby, $orderway);
             break;
         case 'featured':
             $category = new Category(Context::getContext()->shop->getCategory(), $this->langID);
             $products = $category->getProducts((int) $this->langID, 1, $nb, $orderby, $orderway);
             break;
         case 'bestseller':
             $products = ProductSale::getBestSalesLight((int) $this->langID, 0, $nb);
             break;
         case 'special':
             $products = Product::getPricesDrop($this->langID, 0, $nb, false, $orderby, $orderway);
             break;
         case 'random':
             $random = true;
             $products = $this->getProducts('WHERE  p.id_product > 0', (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway, false, true, $random, $nb);
             Configuration::updateValue('LEO_CURRENT_RANDOM_CACHE', '1');
             break;
     }
     $setting['specialtype'] = $setting['specialtype'];
     Context::getContext()->controller->addColorsToProductList($products);
     $setting['products'] = $products;
     $setting['itemsperpage'] = $items_page;
     $setting['columnspage'] = $columns_page;
     $setting['scolumn'] = 12 / $columns_page;
     $setting['interval'] = $interval;
     $setting['tab'] = 'leospecialproduct' . rand(20, rand());
     $output = array('type' => 'specialproduct', 'data' => $setting);
     return $output;
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:48,代码来源:specialcarousel.php


示例10: renderContent

 public function renderContent($args, $setting)
 {
     # validate module
     unset($args);
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $setting['special'] = array();
     $setting['bestseller'] = array();
     $setting['featured'] = array();
     $setting['newproducts'] = array();
     $category = new Category(Context::getContext()->shop->getCategory(), (int) Context::getContext()->language->id);
     $nb = $setting['itemstab'] ? (int) $setting['itemstab'] : 6;
     $orderby = $setting['orderby'] ? $setting['orderby'] : 'position';
     $orderway = $setting['orderway'] ? $setting['orderway'] : 'ASC';
     $items_page = $setting['itemspage'] ? (int) $setting['itemspage'] : 3;
     $columns_page = $setting['columns'] ? (int) $setting['columns'] : 3;
     $interval = isset($setting['interval']) ? (int) $setting['interval'] : 8000;
     if ($setting['featured_display'] && $setting['featured_display'] == 1) {
         $pro_featured = $category->getProducts((int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
         Context::getContext()->controller->addColorsToProductList($pro_featured);
         $setting['featured'] = $pro_featured;
     }
     if ($setting['newarrivals_display'] && $setting['newarrivals_display'] == 1) {
         $pro_newproducts = Product::getNewProducts((int) Context::getContext()->language->id, 0, $nb, false, $orderby, $orderway);
         Context::getContext()->controller->addColorsToProductList($pro_newproducts);
         $setting['newproducts'] = $pro_newproducts;
     }
     if ($setting['special_display'] && $setting['special_display'] == 1) {
         $pro_special = Product::getPricesDrop((int) Context::getContext()->language->id, 0, $nb, false, $orderby, $orderway);
         Context::getContext()->controller->addColorsToProductList($pro_special);
         $setting['special'] = $pro_special;
     }
     if ($setting['bestseller_display'] && $setting['bestseller_display'] == 1) {
         $pro_bestseller = ProductSale::getBestSales((int) Context::getContext()->language->id, 0, $nb, $orderby, $orderway);
         Context::getContext()->controller->addColorsToProductList($pro_bestseller);
         $setting['bestseller'] = $pro_bestseller;
     }
     $setting['itemsperpage'] = $items_page;
     $setting['columnspage'] = $columns_page;
     $setting['interval'] = $interval;
     $setting['scolumn'] = 12 / $columns_page;
     $setting['homeSize'] = Image::getSize(ImageType::getFormatedName('home'));
     $setting['myTab'] = 'leoproducttab' . rand(20, rand());
     $output = array('type' => 'producttabs', 'data' => $setting);
     return $output;
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:46,代码来源:producttabs.php


示例11: hookRightColumn

 public function hookRightColumn($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     global $smarty;
     $currency = new Currency((int) $params['cookie']->id_currency);
     $bestsellers = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, 5);
     if (!$bestsellers and !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) {
         return;
     }
     $best_sellers = array();
     foreach ($bestsellers as $bestseller) {
         $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int) $bestseller['id_product']), $currency);
         $best_sellers[] = $bestseller;
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:19,代码来源:blockbestsellers.php


示例12: changeIdOrderState

 public function changeIdOrderState($new_order_state = NULL, $id_order)
 {
     if ($new_order_state != NULL) {
         Hook::updateOrderStatus(intval($new_order_state), intval($id_order));
         /* Best sellers */
         $newOS = new OrderState(intval($new_order_state));
         $oldOrderStatus = OrderHistory::getLastOrderState(intval($id_order));
         $cart = Cart::getCartByOrderId($id_order);
         $isValidated = $this->isValidated();
         if (Validate::isLoadedObject($cart)) {
             foreach ($cart->getProducts() as $product) {
                 /* If becoming logable => adding sale */
                 if ($newOS->logable and (!$oldOrderStatus or !$oldOrderStatus->logable)) {
                     ProductSale::addProductSale($product['id_product'], $product['cart_quantity']);
                 } elseif (!$newOS->logable and ($oldOrderStatus and $oldOrderStatus->logable)) {
                     ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']);
                 }
                 if (!$isValidated and $newOS->logable and isset($oldOrderStatus) and $oldOrderStatus and $oldOrderStatus->id == _PS_OS_ERROR_) {
                     Product::updateQuantity($product);
                     Hook::updateQuantity($product, $order);
                 }
             }
         }
         $this->id_order_state = intval($new_order_state);
         /* Change invoice number of order ? */
         $newOS = new OrderState(intval($new_order_state));
         $order = new Order(intval($id_order));
         if (!Validate::isLoadedObject($newOS) or !Validate::isLoadedObject($order)) {
             die(Tools::displayError('Invalid new order state'));
         }
         /* The order is valid only if the invoice is available and the order is not cancelled */
         $order->valid = $newOS->logable;
         $order->update();
         if ($newOS->invoice and !$order->invoice_number) {
             $order->setInvoice();
         }
         if ($newOS->delivery and !$order->delivery_number) {
             $order->setDelivery();
         }
         Hook::postUpdateOrderStatus(intval($new_order_state), intval($id_order));
     }
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:42,代码来源:OrderHistory.php


示例13: initContent

 public function initContent()
 {
     if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
         parent::initContent();
         $this->productSort();
         $nbProducts = (int) ProductSale::getNbSales();
         $this->pagination($nbProducts);
         $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
         $this->addColorsToProductList($products);
         $this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displayLeftColumn'), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
         if ($this->ajax) {
             $product_list = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
             $pagination = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl');
             $nbLeftProducts = $nbProducts - ($this->n * ($this->p - 1) + count($products));
             $nbLeftProductsPercentage = ($nbProducts - $nbLeftProducts) / $nbProducts * 100;
             echo Tools::jsonEncode(array('productList' => utf8_encode($product_list), 'pagination' => $pagination, 'nbRenderedProducts' => $nbProducts, 'nbLeftProducts' => $nbLeftProducts, 'nbLeftProductsPercentage' => $nbLeftProductsPercentage));
             die;
         } else {
             $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
         }
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:24,代码来源:BestSalesController.php


示例14: removeProductSale

    public static function removeProductSale($id_product, $qty = 1)
    {
        $total_sales = ProductSale::getNbrSales($id_product);
        if ($total_sales > 1) {
            return Db::getInstance()->execute('
				UPDATE ' . _DB_PREFIX_ . 'product_sale
				SET `quantity` = `quantity` - ' . (int) $qty . ', `sale_nbr` = `sale_nbr` - 1, `date_upd` = NOW()
				WHERE `id_product` = ' . (int) $id_product);
        } elseif ($total_sales == 1) {
            return Db::getInstance()->delete('product_sale', 'id_product = ' . (int) $id_product);
        }
        return true;
    }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:13,代码来源:ProductSale.php


示例15: hookHome

 /**
  * hook home to display generate the product list associated to home featured, news products and best sellers Modules
  */
 public function hookHome()
 {
     $ga_scripts = '';
     // Home featured products
     if ($this->isModuleEnabled('homefeatured')) {
         $category = new Category($this->context->shop->getCategory(), $this->context->language->id);
         $home_featured_products = $this->wrapProducts($category->getProducts((int) Context::getContext()->language->id, 1, Configuration::get('HOME_FEATURED_NBR') ? (int) Configuration::get('HOME_FEATURED_NBR') : 8, 'position'), array(), true);
         $ga_scripts .= $this->addProductImpression($home_featured_products) . $this->addProductClick($home_featured_products);
     }
     // New products
     if ($this->isModuleEnabled('blocknewproducts') && (Configuration::get('PS_NB_DAYS_NEW_PRODUCT') || Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))) {
         $new_products = Product::getNewProducts((int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'));
         $new_products_list = $this->wrapProducts($new_products, array(), true);
         $ga_scripts .= $this->addProductImpression($new_products_list) . $this->addProductClick($new_products_list);
     }
     // Best Sellers
     if ($this->isModuleEnabled('blockbestsellers') && (!Configuration::get('PS_CATALOG_MODE') || Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))) {
         $ga_homebestsell_product_list = $this->wrapProducts(ProductSale::getBestSalesLight((int) $this->context->language->id, 0, 8), array(), true);
         $ga_scripts .= $this->addProductImpression($ga_homebestsell_product_list) . $this->addProductClick($ga_homebestsell_product_list);
     }
     $this->js_state = 1;
     return $this->_runJs($this->filter($ga_scripts));
 }
开发者ID:pierreavizou,项目名称:ganalytics,代码行数:26,代码来源:ganalytics.php


示例16: changeIdOrderState

    /**
     * Sets the new state of the given order
     *
     * @param int $new_order_state
     * @param int/object $id_order
     * @param bool $use_existing_payment
     */
    public function changeIdOrderState($new_order_state, $id_order, $use_existing_payment = false)
    {
        if (!$new_order_state || !$id_order) {
            return;
        }
        if (!is_object($id_order) && is_numeric($id_order)) {
            $order = new Order((int) $id_order);
        } elseif (is_object($id_order)) {
            $order = $id_order;
        } else {
            return;
        }
        ShopUrl::cacheMainDomainForShop($order->id_shop);
        $new_os = new OrderState((int) $new_order_state, $order->id_lang);
        $old_os = $order->getCurrentOrderState();
        $is_validated = $this->isValidated();
        // executes hook
        if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT'), Configuration::get('PS_OS_WS_PAYMENT')))) {
            Hook::exec('actionPaymentConfirmation', array('id_order' => (int) $order->id), null, false, true, false, $order->id_shop);
        }
        // executes hook
        Hook::exec('actionOrderStatusUpdate', array('newOrderStatus' => $new_os, 'id_order' => (int) $order->id), null, false, true, false, $order->id_shop);
        if (Validate::isLoadedObject($order) && $new_os instanceof OrderState) {
            // An email is sent the first time a virtual item is validated
            $virtual_products = $order->getVirtualProducts();
            if ($virtual_products && (!$old_os || !$old_os->logable) && $new_os && $new_os->logable) {
                $context = Context::getContext();
                $assign = array();
                foreach ($virtual_products as $key => $virtual_product) {
                    $id_product_download = ProductDownload::getIdFromIdProduct($virtual_product['product_id']);
                    $product_download = new ProductDownload($id_product_download);
                    // If this virtual item has an associated file, we'll provide the link to download the file in the email
                    if ($product_download->display_filename != '') {
                        $assign[$key]['name'] = $product_download->display_filename;
                        $dl_link = $product_download->getTextLink(false, $virtual_product['download_hash']) . '&id_order=' . (int) $order->id . '&secure_key=' . $order->secure_key;
                        $assign[$key]['link'] = $dl_link;
                        if (isset($virtual_product['download_deadline']) && $virtual_product['download_deadline'] != '0000-00-00 00:00:00') {
                            $assign[$key]['deadline'] = Tools::displayDate($virtual_product['download_deadline']);
                        }
                        if ($product_download->nb_downloadable != 0) {
                            $assign[$key]['downloadable'] = (int) $product_download->nb_downloadable;
                        }
                    }
                }
                $customer = new Customer((int) $order->id_customer);
                $links = '<ul>';
                foreach ($assign as $product) {
                    $links .= '<li>';
                    $links .= '<a href="' . $product['link'] . '">' . Tools::htmlentitiesUTF8($product['name']) . '</a>';
                    if (isset($product['deadline'])) {
                        $links .= '&nbsp;' . Tools::htmlentitiesUTF8(Tools::displayError('expires on', false)) . '&nbsp;' . $product['deadline'];
                    }
                    if (isset($product['downloadable'])) {
                        $links .= '&nbsp;' . Tools::htmlentitiesUTF8(sprintf(Tools::displayError('downloadable %d time(s)', false), (int) $product['downloadable']));
                    }
                    $links .= '</li>';
                }
                $links .= '</ul>';
                $data = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order}' => (int) $order->id, '{order_name}' => $order->getUniqReference(), '{nbProducts}' => count($virtual_products), '{virtualProducts}' => $links);
                // If there's at least one downloadable file
                if (!empty($assign)) {
                    Mail::Send((int) $order->id_lang, 'download_product', Mail::l('Virtual product to download', $order->id_lang), $data, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, false, (int) $order->id_shop);
                }
            }
            // @since 1.5.0 : gets the stock manager
            $manager = null;
            if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                $manager = StockManagerFactory::getManager();
            }
            $errorOrCanceledStatuses = array(Configuration::get('PS_OS_ERROR'), Configuration::get('PS_OS_CANCELED'));
            // foreach products of the order
            if (Validate::isLoadedObject($old_os)) {
                foreach ($order->getProductsDetail() as $product) {
                    // if becoming logable => adds sale
                    if ($new_os->logable && !$old_os->logable) {
                        ProductSale::addProductSale($product['product_id'], $product['product_quantity']);
                        // @since 1.5.0 - Stock Management
                        if (!Pack::isPack($product['product_id']) && in_array($old_os->id, $errorOrCanceledStatuses) && !StockAvailable::dependsOnStock($product['id_product'], (int) $order->id_shop)) {
                            StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], -(int) $product['product_quantity'], $order->id_shop);
                        }
                    } elseif (!$new_os->logable && $old_os->logable) {
                        ProductSale::removeProductSale($product['product_id'], $product['product_quantity']);
                        // @since 1.5.0 - Stock Management
                        if (!Pack::isPack($product['product_id']) && in_array($new_os->id, $errorOrCanceledStatuses) && !StockAvailable::dependsOnStock($product['id_product'])) {
                            StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int) $product['product_quantity'], $order->id_shop);
                        }
                    } elseif (!$new_os->logable && !$old_os->logable && in_array($new_os->id, $errorOrCanceledStatuses) && !in_array($old_os->id, $errorOrCanceledStatuses) && !StockAvailable::dependsOnStock($product['id_product'])) {
                        StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int) $product['product_quantity'], $order->id_shop);
                    }
                    // @since 1.5.0 : if the order is being shipped and this products uses the advanced stock management :
                    // decrements the physical stock using $id_warehouse
                    if ($new_os->shipped == 1 && $old_os->shipped == 0 && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && Warehouse::exists($product['id_warehouse']) && $manager != null && ((int) $product['advanced_stock_management'] == 1 || Pack::usesAdvancedStockManagement($product['product_id']))) {
                        // gets the warehouse
//.........这里部分代码省略.........
开发者ID:dev-lav,项目名称:htdocs,代码行数:101,代码来源:OrderHistory.php


示例17: getTopSalesProducts

 public function getTopSalesProducts()
 {
     //see if the html fragment is in memcache
     $memcache = new Memcache();
     if ($memcache->connect('127.0.0.1', 11211)) {
         $topProducts = $memcache->get('brand-top-products-' . $this->manufacturer->id);
         if ($topProducts) {
             return $topProducts;
         } else {
             $topProducts = ProductSale::getBestSalesManufacturer((int) self::$cookie->id_lang, $this->manufacturer->id, 0, 15, null, null, false);
             $memcache->set('brand-top-products-' . $this->manufacturer->id, $topProducts, false, 172800);
             //cache for 2 days
             return $topProducts;
         }
     } else {
         return ProductSale::getBestSalesManufacturer((int) self::$cookie->id_lang, $this->manufacturer->id, 0, 15, null, null, false);
     }
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:18,代码来源:ManufacturerController.php


示例18: getProductsProperties

 public static function getProductsProperties($id_lang, $query_result)
 {
     $results_array = array();
     if (is_array($query_result)) {
         foreach ($query_result as $row) {
             if ($row2 = Product::getProductProperties($id_lang, $row)) {
                 if (Pack::isPack($row['id_product'])) {
                     $row2['is_pack'] = true;
                     $row2['pack_items'] = Pack::getItemTable($row['id_product'], $id_lang, true);
                     if (!$row2['pack_items']) {
                         $row2['pack_items'] = array();
                     }
                 }
                 $row['is_bestsaler'] = ProductSale::isBestsaler($row['id_product']);
                 $results_array[] = $row2;
             }
         }
     }
     return $results_array;
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:20,代码来源:Product.php


示例19: renderContent

 public function renderContent($args, $setting)
 {
     # validate module
     unset($args);
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $nb = $setting['itemstab'] ? (int) $setting['itemstab'] : 6;
     $orderby = $setting['orderby'] ? $setting['orderby'] : 'date_add';
     $orderway = $setting['orderway'] ? $setting['orderway'] : 'ASC';
     $items_page = $setting['itemspage'] ? (int) $setting['itemspage'] : 3;
     $columns_page = $setting['columns'] ? (int) $setting['columns'] : 3;
     $interval = isset($setting['interval']) ? (int) $setting['interval'] : 8000;
     switch ($setting['source']) {
         case 'ptype':
             switch ($setting['ptype']) {
                 case 'newest':
                     $products = Product::getNewProducts($this->langID, 0, $nb, false, $orderby, $orderway);
                     break;
                 case 'featured':
                     $category = new Category(Context::getContext()->shop->getCategory(), $this->langID);
                     $products = $category->getProducts((int) $this->langID, 1, $nb, $orderby, $orderway);
                     break;
                 case 'bestseller':
                     $products = ProductSale::getBestSalesLight((int) $this->langID, 0, $nb);
                     break;
                 case 'special':
                     $products = Product::getPricesDrop($this->langID, 0, $nb, false, $orderby, $orderway);
                     break;
                 case 'random':
                     $random = true;
                     $products = $this->getProducts('WHERE  p.id_product > 0', (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway, false, true, $random, $nb);
                     Configuration::updateValue('LEO_CURRENT_RANDOM_CACHE', '1');
                     break;
             }
             break;
         case 'pproductids':
             $where = '';
             if (empty($setting['pproductids'])) {
                 return false;
             }
             if ($pproductids = $setting['pproductids']) {
                 $where = 'WHERE  p.id_product IN  (' . pSQL($pproductids) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
             break;
         case 'pcategories':
             $where = '';
             $catids = isset($setting['categories']) && $setting['categories'] ? $setting['categories'] : array();
             $products = array();
             if ($catids) {
                 $categorys = implode(',', $catids);
                 $where = 'WHERE  cp.id_category IN  (' . pSQL($categorys) . ')';
                 $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
             }
             break;
         case 'pmanufacturers':
             $where = '';
             $manufacturers = $setting['pmanufacturer'] ? $setting['pmanufacturer'] : array();
             if ($manufacturers) {
                 $manufacturers = implode(',', $manufacturers);
                 $where = 'WHERE  p.id_manufacturer IN  (' . pSQL($manufacturers) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
             break;
     }
     Context::getContext()->controller->addColorsToProductList($products);
     $setting['products'] = $products;
     $setting['itemsperpage'] = $items_page;
     $setting['columnspage'] = $columns_page;
     $setting['scolumn'] = 12 / $columns_page;
     $setting['interval'] = $interval;
     $setting['homeSize'] = Image::getSize(ImageType::getFormatedName('home'));
     $setting['tab'] = 'leoproductcarousel' . rand(20, rand());
     $output = array('type' => 'carousel', 'data' => $setting);
     return $output;
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:76,代码来源:carousel.php


示例20: changeIdOrderState

    /**
     * Sets the new state of the given order
     *
     * @param int $new_order_state
     * @param int $id_order
     * @param bool $use_existing_payment
     */
    public function changeIdOrderState($new_order_state, &$id_order, $use_existing_payment = false)
    {
        if (!$new_order_state || !$id_order) {
            return;
        }
        if (!is_object($id_order) && is_numeric($id_order)) {
            $order = new Order((int) $id_order);
        } elseif (is_object($id_order)) {
            $order = $id_order;
        } else {
            return;
        }
        $new_os = new OrderState((int) $new_order_state, $order->id_lang);
        $old_os = $order->getCurrentOrderState();
        $is_validated = $this->isValidated();
        // executes hook
        if ($new_os->id == Configuration::get('PS_OS_PAYMENT')) {
            Hook::exec('actionPaymentConfirmation', array('id_order' => (int) $order->id));
        }
        // executes hook
        Hook::exec('actionOrderStatusUpdate', array('newOrderStatus' => $new_os, 'id_order' => (int) $order->id));
        if (Validate::isLoadedObject($order) && $old_os instanceof OrderState && $new_os instanceof OrderState) {
            // @since 1.5.0 : gets the stock manager
            $manager = null;
            if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                $manager = StockManagerFactory::getManager();
            }
            // foreach products of the order
            foreach ($order->getProductsDetail() as $product) {
                // if becoming logable => adds sale
                if ($new_os->logable && !$old_os->logable) {
                    ProductSale::addProductSale($product['product_id'], $product['product_quantity']);
                    // @since 1.5.0 - Stock Management
                    if (!Pack::isPack($product['product_id']) && ($old_os->id == Configuration::get('PS_OS_ERROR') || $old_os->id == Configuration::get('PS_OS_CANCELED')) && !StockAvailable::dependsOnStock($product['id_product'], (int) $order->id_shop)) {
                        StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], -(int) $product['product_quantity'], $order->id_shop);
                    }
                } elseif (!$new_os->logable && $old_os->logable) {
                    ProductSale::removeProductSale($product['product_id'], $product['product_quantity']);
                    // @since 1.5.0 - Stock Management
                    if (!Pack::isPack($product['product_id']) && ($new_os->id == Configuration::get('PS_OS_ERROR') || $new_os->id == Configuration::get('PS_OS_CANCELED')) && !StockAvailable::dependsOnStock($product['id_product'])) {
                        StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int) $product['product_quantity'], $order->id_shop);
                    }
                } elseif (!$new_os->logable && !$old_os->logable && ($new_os->id == Config 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ProductSupplier类代码示例发布时间:2022-05-23
下一篇:
PHP ProductDownload类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap