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


PHP Product::getProductName方法代码示例

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


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

示例1: __construct

 /**
  * @param	Product $product
  * @param	integer $qtd
  */
 public function __construct(Product $product, $qtd)
 {
     parent::__construct();
     $resourceBundle = Application::getInstance()->getBundle();
     $idProduct = $product->getIdProduct();
     $moneyformat = $resourceBundle->getString('MONEY_FORMAT');
     $productName = $product->getProductName();
     $productDescription = $product->getProductDescription();
     $productPrice = $product->getProductPrice();
     $form = $this->addChild(new Form('/?c=cart&a=change&p=' . $idProduct));
     //Imagem do produto
     $form->addChild(new Image($product->getProductImage(), $productName))->setTitle($productName)->setAttribute('width', 80)->setAttribute('height', 80);
     //Nome e descrição do produto
     $form->addChild(new Span())->addStyle('name')->addChild(new Text($productName));
     $form->addChild(new Span())->addStyle('desc')->addChild(new Text($productDescription));
     //Input com a quantidade de itens
     $form->addChild(new Label(new Text($resourceBundle->getString('QUANTITY'))))->addChild(new Input('qtd'))->setValue($qtd);
     //Preço unitário
     $form->addChild(new Span())->addStyle('price')->addChild(new Text(money_format($moneyformat, $productPrice)));
     //Preço total
     $form->addChild(new Span())->addStyle('total')->addChild(new Text(money_format($moneyformat, $qtd * $productPrice)));
     //Botões para edição e exclusão do item do carrinho
     $form->addChild(new Input('save', Input::SUBMIT))->setValue($resourceBundle->getString('SAVE'));
     $form->addChild(new Input('del', Input::SUBMIT))->setValue($resourceBundle->getString('DELETE'));
 }
开发者ID:rcastardo,项目名称:mvc-na-pratica,代码行数:29,代码来源:CartItem.php

示例2: init

 /**
  * Initialize order controller
  * @see FrontController::init()
  */
 public function init()
 {
     global $orderTotal;
     parent::init();
     $this->step = (int) Tools::getValue('step');
     if (!$this->nbProducts) {
         $this->step = -1;
     }
     $product = $this->context->cart->checkQuantities(true);
     if ((int) ($id_product = $this->context->cart->checkProductsAccess())) {
         $this->step = 0;
         $this->errors[] = sprintf(Tools::displayError('An item in your cart is no longer available (%1s). You cannot proceed with your order.'), Product::getProductName((int) $id_product));
     }
     // If some products have disappear
     if (is_array($product)) {
         $this->step = 0;
         $this->errors[] = sprintf(Tools::displayError('An item (%1s) in your cart is no longer available in this quantity. You cannot proceed with your order until the quantity is adjusted.'), $product['name']);
     }
     // Check minimal amount
     $currency = Currency::getCurrency((int) $this->context->cart->id_currency);
     $orderTotal = $this->context->cart->getOrderTotal();
     $minimal_purchase = Tools::convertPrice((double) Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
     if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase && $this->step > 0) {
         $this->step = 0;
         $this->errors[] = sprintf(Tools::displayError('A minimum purchase total of %1s (tax excl.) is required to validate your order, current purchase total is %2s (tax excl.).'), Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency));
     }
     if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3))) {
         $params = array();
         if ($this->step) {
             $params['step'] = (int) $this->step;
         }
         if ($multi = (int) Tools::getValue('multi-shipping')) {
             $params['multi-shipping'] = $multi;
         }
         $back_url = $this->context->link->getPageLink('order', true, (int) $this->context->language->id, $params);
         $params = array('back' => $back_url);
         if ($multi) {
             $params['multi-shipping'] = $multi;
         }
         if ($guest = (int) Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
             $params['display_guest_checkout'] = $guest;
         }
         Tools::redirect($this->context->link->getPageLink('authentication', true, (int) $this->context->language->id, $params));
     }
     if (Tools::getValue('multi-shipping') == 1) {
         $this->context->smarty->assign('multi_shipping', true);
     } else {
         $this->context->smarty->assign('multi_shipping', false);
     }
     if ($this->context->customer->id) {
         $this->context->smarty->assign('address_list', $this->context->customer->getAddresses($this->context->language->id));
     } else {
         $this->context->smarty->assign('address_list', array());
     }
 }
开发者ID:ac3gam3r,项目名称:Maxokraft,代码行数:59,代码来源:OrderController.php

示例3: ajaxProcess

    /**
     * Method called when an ajax request is made
     * @see AdminController::postProcess()
     */
    public function ajaxProcess()
    {
        if (Tools::isSubmit('id')) {
            $this->lang = false;
            $lang_id = (int) $this->context->language->id;
            $id_product = (int) Tools::getValue('id');
            $period = Tools::getValue('period') ? (int) Tools::getValue('period') : 7;
            $warehouse = Tools::getValue('id_warehouse', -1);
            $where_warehouse = '';
            if ($warehouse != -1) {
                $where_warehouse = ' AND s.id_warehouse = ' . (int) $warehouse;
            }
            $query = new DbQuery();
            $query->select('pa.id_product_attribute as id, pa.id_product, stock_view.reference, stock_view.ean13,
							stock_view.upc, stock_view.usable_quantity as stock');
            $query->from('product_attribute', 'pa');
            $query->join('INNER JOIN
						  (
						  	SELECT SUM(s.usable_quantity) as usable_quantity, s.id_product_attribute, s.reference, s.ean13, s.upc
						   	FROM ' . _DB_PREFIX_ . 'stock s
						   	WHERE s.id_product = ' . $id_product . $where_warehouse . '
						   	GROUP BY s.id_product_attribute
						   )
						   stock_view ON (stock_view.id_product_attribute = pa.id_product_attribute)');
            $query->where('pa.id_product = ' . $id_product);
            $query->groupBy('pa.id_product_attribute');
            $datas = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
            foreach ($datas as &$data) {
                $data['name'] = Product::getProductName($data['id_product'], $data['id']);
                // computes coverage
                $coverage = StockManagerFactory::getManager()->getProductCoverage($data['id_product'], $data['id'], $period, $this->getCurrentCoverageWarehouse() == -1 ? null : $warehouse);
                if ($coverage != -1) {
                    if ($coverage < $this->getCurrentWarning()) {
                        // if highlight needed
                        $data['color'] = '#BDE5F8';
                    }
                    $data['coverage'] = $coverage;
                } else {
                    // infinity
                    $data['coverage'] = '--';
                }
                // computes quantity sold
                $qty_sold = $this->getQuantitySold($data['id_product'], $data['id'], $this->getCurrentCoveragePeriod());
                if (!$qty_sold) {
                    $data['qty_sold'] = '--';
                } else {
                    $data['qty_sold'] = $qty_sold;
                }
            }
            echo Tools::jsonEncode(array('data' => $datas, 'fields_display' => $this->fields_list));
        }
        die;
    }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:57,代码来源:AdminStockCoverController.php

示例4: __construct

 /**
  * @param	Product $product
  */
 public function __construct(Product $product)
 {
     parent::__construct();
     $resourceBundle = Application::getInstance()->getBundle();
     $productName = $product->getProductName();
     $moneyFormat = $resourceBundle->getString('MONEY_FORMAT');
     $buy = $resourceBundle->getString('BUY');
     $definitionList = $this->addChild(new DefinitionList());
     $definitionList->addChild(new DefinitionTerm())->addChild(new Text($productName));
     $definitionList->addChild(new DefinitionDescription())->addStyle('description')->addChild(new Text($product->getProductDescription()));
     $definitionList->addChild(new DefinitionDescription())->addStyle('image')->addChild(new Image($product->getProductImage(), $productName))->setAttribute('width', 190)->setAttribute('height', 190)->setTitle($productName);
     $definitionList->addChild(new DefinitionDescription())->addStyle('price')->addChild(new Text(money_format($moneyFormat, $product->getProductPrice())));
     $this->addChild(new Anchor('/?c=cart&a=add&p=' . $product->getIdProduct()))->setTitle($buy)->addStyle('buy-button')->addChild(new Text($buy));
 }
开发者ID:rcastardo,项目名称:mvc-na-pratica,代码行数:17,代码来源:ProductItem.php

示例5: getProductDetailsByParcels

 public static function getProductDetailsByParcels($parcels)
 {
     $products = array();
     foreach ($parcels as $parcel) {
         if (isset($parcel['id_parcel'])) {
             if ($products_array = self::getProductByIdParcel($parcel['id_parcel'])) {
                 foreach ($products_array as $product) {
                     if (self::isLabelPrinted($parcel['id_parcel'])) {
                         $product_data = self::getProductNameAndWeight($parcel['id_parcel'], $product['id_product'], $product['id_product_attribute']);
                         $products[] = array_merge($product, array('name' => $product_data['name'], 'weight' => (double) $product_data['weight'], 'id_parcel' => (int) $parcel['id_parcel']));
                     } else {
                         $product_obj = new Product($product['id_product']);
                         $combination = new Combination($product['id_product_attribute']);
                         $products[] = array_merge($product, array('name' => version_compare(_PS_VERSION_, '1.5', '<') ? $product_obj->name[(int) Context::getContext()->language->id] : Product::getProductName($product['id_product'], $product['id_product_attribute']), 'weight' => (double) $combination->weight + (double) $product_obj->weight, 'id_parcel' => (int) $parcel['id_parcel']));
                     }
                 }
             }
         }
     }
     return $products;
 }
开发者ID:rokaszygmantas,项目名称:dpdpoland,代码行数:21,代码来源:ParcelProduct.php

示例6: generateGroupProductList

 protected function generateGroupProductList($productIds = array())
 {
     if (!$productIds) {
         return '';
     }
     $result = '';
     $langId = Context::getContext()->language->id;
     foreach ($productIds as $productId) {
         if ((int) $productId > 0) {
             $productName = Product::getProductName((int) $productId, null, $langId);
             if ($productName) {
                 $result .= '<li id="manual-product-' . $productId . '" class="manual-product">
                                 <input type="hidden" class="manual_product_id" name="product_ids[]" value="' . $productId . '" />
                                 <span>' . $productName . '</span>
                                 <a href="javascript:void(0)" title="' . $this->l('Delete') . '" class="link-trash-manual-product c-red pull-right" data-id="' . $productId . '"><i class="icon-trash"></i></a>
                             </li>';
             }
         }
     }
     return $result;
 }
开发者ID:zangles,项目名称:lennyba,代码行数:21,代码来源:megaboxs.php

示例7: saveProductsIntoParcel

 private function saveProductsIntoParcel(DpdPolandParcel $parcel, $products)
 {
     foreach ($products as $product) {
         if ($product['parcel'] == $parcel->number) {
             $parcelProduct = new DpdPolandParcelProduct();
             $parcelProduct->id_parcel = (int) $parcel->id_parcel;
             $parcelProduct->id_product = (int) $product['id_product'];
             $parcelProduct->id_product_attribute = (int) $product['id_product_attribute'];
             $productObj = new Product((int) $product['id_product']);
             $combination = new Combination((int) $product['id_product_attribute']);
             $parcelProduct->name = version_compare(_PS_VERSION_, '1.5', '<') ? $productObj->name[(int) Context::getContext()->language->id] : Product::getProductName($product['id_product'], $product['id_product_attribute']);
             $parcelProduct->weight = (double) $combination->weight + (double) $productObj->weight;
             if (!$parcelProduct->add()) {
                 self::$errors[] = sprintf($this->l('Unable to save product #%s to parcel #%d'), $parcelProduct->id_product . '-' . $parcelProduct->id_product_attribute, $parcelProduct->id_parcel);
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:rokaszygmantas,项目名称:dpdpoland,代码行数:20,代码来源:dpdpoland.php

示例8: ajaxProcessAddDataToCart

 public function ajaxProcessAddDataToCart()
 {
     // for Add Quantity
     $id_room = Tools::getValue('id_room');
     $booking_type = Tools::getValue('booking_type');
     $comment = Tools::getValue('comment');
     // for both (add , delete)
     $id_hotel = Tools::getValue('id_hotel');
     $id_product = Tools::getValue('id_prod');
     $date_from = Tools::getValue('date_from');
     $date_to = Tools::getValue('date_to');
     $search_id_prod = Tools::getValue('search_id_prod');
     $search_date_from = Tools::getValue('search_date_from');
     $search_date_to = Tools::getValue('search_date_to');
     // for delete quantity
     $id_cart = Tools::getValue('id_cart');
     $id_cart_book_data = Tools::getValue('id_cart_book_data');
     $ajax_delete = Tools::getValue('ajax_delete');
     // If delete from cart(not for room list delete(pagebottom tabs))
     $opt = Tools::getValue('opt');
     // if 1 then add quantity or if 0 means delete quantity
     // discuss later
     //
     // $obj_hotel_info = new HotelBranchInformation();
     // $hotel_info = $obj_hotel_info->hotelBranchInfoById($id_hotel);
     // $date_from = date('Y-m-d H:i:s', strtotime("$date_from +".date('H', strtotime($hotel_info['check_in']))." hours +".date('i', strtotime($hotel_info['check_in']))." minutes"));
     // $date_to = date('Y-m-d H:i:s', strtotime("$date_to +".date('H', strtotime($hotel_info['check_out']))." hours +".date('i', strtotime($hotel_info['check_out']))." minutes"));
     $obj_booking_dtl = new HotelBookingDetail();
     $num_day = $obj_booking_dtl->getNumberOfDays($date_from, $date_to);
     //quantity of product
     $product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'));
     // $id_product_attribute = $product->getDefaultIdProductAttribute();
     if ($opt) {
         // $cart_rules = $this->context->cart->getCartRules();
         $amount = Product::getPriceStatic($id_product, true, null, 6, null, false, true, $num_day);
     }
     if ($opt) {
         $direction = 'up';
     } else {
         $direction = 'down';
     }
     $this->context->cart->updateQty($num_day, $id_product, null, false, $direction);
     $total_amount = $this->context->cart->getOrderTotal();
     $id_cart = $this->context->cart->id;
     $id_guest = $this->context->cookie->id_guest;
     $obj_cart_book_data = new HotelCartBookingData();
     if ($opt) {
         $obj_cart_book_data->id_cart = $id_cart;
         $obj_cart_book_data->id_guest = $id_guest;
         $obj_cart_book_data->id_product = $id_product;
         $obj_cart_book_data->id_room = $id_room;
         $obj_cart_book_data->id_hotel = $id_hotel;
         $obj_cart_book_data->amount = $amount;
         $obj_cart_book_data->booking_type = $booking_type;
         $obj_cart_book_data->comment = $comment;
         $obj_cart_book_data->date_from = $date_from;
         $obj_cart_book_data->date_to = $date_to;
         $obj_cart_book_data->save();
         $obj_rm_info = new HotelRoomInformation($id_room);
         $rms_in_cart = $obj_cart_book_data->getCountRoomsInCart($id_cart, $id_guest);
         $booking_stats = $obj_booking_dtl->getBookingData($date_from, $date_to, $id_hotel, $search_id_prod, 0, 0, 1, 1, 1, 1, 0, 0, $id_cart, $id_guest, 1);
         $cart_data = array('room_num' => $obj_rm_info->room_num, 'room_type' => Product::getProductName((int) $id_product), 'date_from' => date('Y-M-d', strtotime($date_from)), 'date_to' => date('Y-M-d', strtotime($date_to)), 'amount' => $amount, 'qty' => $num_day, 'rms_in_cart' => $rms_in_cart, 'total_amount' => $total_amount, 'booking_stats' => $booking_stats, 'id_cart_book_data' => $obj_cart_book_data->id);
         if ($obj_cart_book_data->id) {
             die(Tools::jsonEncode($cart_data));
         } else {
             die(0);
         }
     } else {
         $data_dlt = $obj_cart_book_data->deleteRowById($id_cart_book_data);
         if ($data_dlt) {
             $rms_in_cart = $obj_cart_book_data->getCountRoomsInCart($id_cart, $id_guest);
             if (!$ajax_delete) {
                 $booking_stats = $obj_booking_dtl->getBookingData($date_from, $date_to, $id_hotel, $search_id_prod, 0, 0, 1, 1, 1, 1, 0, 0, $id_cart, $id_guest, 1);
                 $cart_data = array('total_amount' => $total_amount, 'rms_in_cart' => $rms_in_cart, 'booking_stats' => $booking_stats);
             }
             if ($ajax_delete) {
                 $obj_htl_info = new HotelBranchInformation();
                 $obj_rm_type = new HotelRoomType();
                 $this->context->smarty->assign(array('id_cart' => $id_cart, 'id_guest' => $id_guest));
                 // No use of adult, child, num_rooms
                 $adult = 0;
                 $children = 0;
                 $num_rooms = 1;
                 $booking_data = array();
                 $booking_data = $obj_booking_dtl->getBookingData($search_date_from, $search_date_to, $id_hotel, $search_id_prod, $adult, $children, $num_rooms, 0, 1, 1, 1, 1, $id_cart, $id_guest, 1);
                 $this->context->smarty->assign(array('date_from' => $date_from, 'date_to' => $date_to, 'booking_data' => $booking_data, 'ajax_delete' => $ajax_delete));
                 $tpl_path = 'hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl';
                 $room_tpl = $this->context->smarty->fetch(_PS_MODULE_DIR_ . $tpl_path);
                 $cart_data = array('total_amount' => $total_amount, 'room_tpl' => $room_tpl, 'rms_in_cart' => $rms_in_cart, 'booking_data' => $booking_data);
             }
             die(Tools::jsonEncode($cart_data));
         } else {
             die(0);
         }
     }
 }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:96,代码来源:AdminHotelRoomsBookingController.php

示例9: ajaxGetProducts

 public function ajaxGetProducts()
 {
     if (Tools::isSubmit('id_order')) {
         $product_return_template = array();
         require_once _PS_MODULE_DIR_ . 'erpillicopresta/classes/order/ErpOrder.php';
         $objOrder = new ErpOrder((int) Tools::getValue('id_order'));
         $produits = $objOrder->getListOfProductsWithQuantity();
         if (!empty($produits)) {
             foreach ($produits as $key => &$prod) {
                 $objProd = new Product($prod['product_id']);
                 // If order is neither sent, nor cancelled, nor the current one
                 $product_return_template[$key]['reference'] = $objProd->reference;
                 $product_return_template[$key]['name'] = $objProd->getProductName($prod['product_id'], $prod['product_attribute_id']);
                 $product_return_template[$key]['quantity'] = $prod['product_quantity'];
                 if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                     $manager = StockManagerFactory::getManager();
                     $product_return_template[$key]['physical_stock'] = $manager->getProductPhysicalQuantities($prod['product_id'], $prod['product_attribute_id']);
                     $product_return_template[$key]['usable_stock'] = $manager->getProductPhysicalQuantities($prod['product_id'], $prod['product_attribute_id'], null, true);
                     $product_return_template[$key]['real_stock'] = $manager->getProductRealQuantities($prod['product_id'], $prod['product_attribute_id']);
                 } else {
                     $product_return_template[$key]['stock'] = StockAvailable::getQuantityAvailableByProduct($prod['product_id'], $prod['product_attribute_id']);
                 }
             }
         }
         $this->context->smarty->assign(array('products' => $product_return_template));
         echo $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/advanced_order/quick_view.tpl');
         die;
     }
 }
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:29,代码来源:AdminAdvancedOrder.php

示例10: getGroupCategoryProduct

    protected function getGroupCategoryProduct($products = array())
    {
        $result = '';
        if ($products) {
            foreach ($products as $productId) {
                $productName = Product::getProductName($productId);
                $result .= '<li id="manual-product-' . $productId . '">
								<input type="hidden" class="manual_product_id" name="product_ids[]" value="' . $productId . '" />
								<span>' . $productName . '</span>
								<a class="manual-product-delete pull-right" data-id="' . $productId . '"><i class="icon-trash "></i></a>
							</li>';
            }
        }
        return $result;
    }
开发者ID:abdoumej,项目名称:libsamy,代码行数:15,代码来源:groupcategory.php

示例11: foreach

								<th>' . $erpip->l('SKU') . '</th>
								<th>' . $erpip->l('Description') . '</th>
								<th>' . $erpip->l('Quantity') . '</th>';
            if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                $message .= '<th>' . $erpip->l('Physical Stock') . '</th>
							 <th>' . $erpip->l('Usable Stock') . '</th>
							 <th>' . $erpip->l('Real Stock') . '</th>';
            } else {
                $message .= '<th>' . $erpip->l('Stock') . '</th>';
            }
            $message .= '</tr>';
            foreach ($produits as &$prod) {
                $objProd = new Product($prod['product_id']);
                $message .= '<tr>';
                /*  If order neither sent nor cancelled nor current order */
                $message .= '<td>' . $objProd->reference . '</td><td>' . $objProd->getProductName($prod['product_id'], $prod['product_attribute_id']) . '</td><td>' . $prod['product_quantity'] . '</td>';
                if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
                    $manager = StockManagerFactory::getManager();
                    $message .= '<td>' . $manager->getProductPhysicalQuantities($prod['product_id'], $prod['product_attribute_id']) . '</td>' . '<td>' . $manager->getProductPhysicalQuantities($prod['product_id'], $prod['product_attribute_id'], null, true) . '</td>' . '<td>' . $manager->getProductRealQuantities($prod['product_id'], $prod['product_attribute_id']) . '</td>';
                } else {
                    $message .= '<td>' . StockAvailable::getQuantityAvailableByProduct($prod['product_id'], $prod['product_attribute_id']) . '</td>';
                }
                $message .= '</tr>';
            }
            $message .= '</table>';
            print $message;
        }
        break;
    case 'productSupplierPrice':
        /*  If we have called the script with a term to search */
        if (Tools::isSubmit('id_product') && Tools::isSubmit('id_product_attribute')) {
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:31,代码来源:ajax.php

示例12: manageOrderProducts

 /**
  * Ths method manage associated products to the order when updating it
  */
 public function manageOrderProducts()
 {
     // load supply order
     $id_supply_order = (int) Tools::getValue('id_supply_order', null);
     $products_already_in_order = array();
     if ($id_supply_order != null) {
         $supply_order = new SupplyOrder($id_supply_order);
         if (Validate::isLoadedObject($supply_order)) {
             // tests if the supplier or currency have changed in the supply order
             $new_supplier_id = (int) Tools::getValue('id_supplier');
             $new_currency_id = (int) Tools::getValue('id_currency');
             if ($new_supplier_id != $supply_order->id_supplier || $new_currency_id != $supply_order->id_currency) {
                 // resets all products in this order
                 $supply_order->resetProducts();
             } else {
                 $products_already_in_order = $supply_order->getEntries();
                 $currency = new Currency($supply_order->id_ref_currency);
                 // gets all product ids to manage
                 $product_ids_str = Tools::getValue('product_ids', null);
                 $product_ids = explode('|', $product_ids_str);
                 $product_ids_to_delete_str = Tools::getValue('product_ids_to_delete', null);
                 $product_ids_to_delete = array_unique(explode('|', $product_ids_to_delete_str));
                 //delete products that are not managed anymore
                 foreach ($products_already_in_order as $paio) {
                     $product_ok = false;
                     foreach ($product_ids_to_delete as $id) {
                         $id_check = $paio['id_product'] . '_' . $paio['id_product_attribute'];
                         if ($id_check == $id) {
                             $product_ok = true;
                         }
                     }
                     if ($product_ok === true) {
                         $entry = new SupplyOrderDetail($paio['id_supply_order_detail']);
                         $entry->delete();
                         //--ERP information
                         // delete bind in erp_supply_order_detail table
                         $id_erpip_supply_order_detail = ErpSupplyOrderDetail::getErpSupplierOrderDetailIdBySupplierOrderDetailId((int) $paio['id_supply_order_detail']);
                         if ((int) $id_erpip_supply_order_detail > 0) {
                             $erp_supply_order_detail = new ErpSupplyOrderDetail((int) $id_erpip_supply_order_detail);
                             $erp_supply_order_detail->delete();
                         }
                     }
                 }
                 // manage each product
                 foreach ($product_ids as $id) {
                     // if quantity is null, we dont save product in supply order
                     if (Tools::getValue('input_quantity_expected_' . $id, 0) == '0') {
                         continue;
                     }
                     $errors = array();
                     // check if a checksum is available for this product and test it
                     $check = Tools::getValue('input_check_' . $id, '');
                     $check_valid = md5(_COOKIE_KEY_ . $id);
                     if ($check_valid != $check) {
                         continue;
                     }
                     $pos = strpos($id, '_');
                     if ($pos === false) {
                         continue;
                     }
                     // Load / Create supply order detail
                     $entry = new SupplyOrderDetail();
                     $id_supply_order_detail = (int) Tools::getValue('input_id_' . $id, 0);
                     if ($id_supply_order_detail > 0) {
                         $existing_entry = new SupplyOrderDetail($id_supply_order_detail);
                         if (Validate::isLoadedObject($supply_order)) {
                             $entry =& $existing_entry;
                         }
                     }
                     // get product informations
                     $entry->id_product = Tools::substr($id, 0, $pos);
                     $entry->id_product_attribute = Tools::substr($id, $pos + 1);
                     $entry->unit_price_te = (double) str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_unit_price_te_' . $id, 0));
                     $entry->quantity_expected = (int) str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_quantity_expected_' . $id, 0));
                     $entry->discount_rate = (double) str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_discount_rate_' . $id, 0));
                     $entry->tax_rate = (double) str_replace(array(' ', ','), array('', '.'), Tools::getValue('input_tax_rate_' . $id, 0));
                     $entry->reference = Tools::getValue('input_reference_' . $id, '');
                     $entry->supplier_reference = Tools::getValue('input_supplier_reference_' . $id, '');
                     $entry->ean13 = Tools::getValue('input_ean13_' . $id, '');
                     $entry->upc = Tools::getValue('input_upc_' . $id, '');
                     // fixed bug of discount_value_te field while % is null
                     if ($entry->discount_rate == '0.000000') {
                         $entry->discount_value_te = '0.000000';
                     }
                     //get the product name in the order language
                     $entry->name = Product::getProductName($entry->id_product, $entry->id_product_attribute, $supply_order->id_lang);
                     if (empty($entry->name)) {
                         $entry->name = '';
                     }
                     if ($entry->supplier_reference == null) {
                         $entry->supplier_reference = '';
                     }
                     $entry->exchange_rate = $currency->conversion_rate;
                     $entry->id_currency = $currency->id;
                     $entry->id_supply_order = $supply_order->id;
                     $errors = $entry->validateController();
                     //get the product name displayed in the backoffice according to the employee language
//.........这里部分代码省略.........
开发者ID:prestamodule,项目名称:erpillicopresta,代码行数:101,代码来源:AdminAdvancedSupplyOrder.php

示例13: getWSProductName

 /**
  * Webservice : getter for the product name
  */
 public function getWSProductName()
 {
     $res = array();
     foreach (Language::getIDs(true) as $id_lang) {
         $res[$id_lang] = Product::getProductName($this->id_product, $this->id_product_attribute, $id_lang);
     }
     return $res;
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:11,代码来源:StockMvtWS.php

示例14: getWSProductName

 /**
  * Webservice : getter for the product name
  */
 public function getWSProductName()
 {
     $languages = Language::getLanguages(true);
     $res = array();
     foreach ($languages as $language) {
         $res[$language['id_lang']] = Product::getProductName($this->id_product, $this->id_product_attribute, $language['id_lang']);
     }
     return $res;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:12,代码来源:StockMvtWS.php

示例15: loadProducts

    /**
     * Loads products which quantity (hysical quantity) is equal or less than $threshold
     * @param int $threshold
     */
    protected function loadProducts($threshold)
    {
        // if there is already an order
        if (Tools::getValue('id_supply_order')) {
            $supply_order = new SupplyOrder((int) Tools::getValue('id_supply_order'));
        } else {
            // else, we just created a new order
            $supply_order = $this->object;
        }
        // if order is not valid, return;
        if (!Validate::isLoadedObject($supply_order)) {
            return;
        }
        // resets products if needed
        if (Tools::getValue('id_supply_order')) {
            $supply_order->resetProducts();
        }
        // gets products
        $query = new DbQuery();
        $query->select('
			ps.id_product,
			ps.id_product_attribute,
			ps.product_supplier_reference as supplier_reference,
			ps.product_supplier_price_te as unit_price_te,
			ps.id_currency,
			IFNULL(pa.reference, IFNULL(p.reference, \'\')) as reference,
			IFNULL(pa.ean13, IFNULL(p.ean13, \'\')) as ean13,
			IFNULL(pa.upc, IFNULL(p.upc, \'\')) as upc');
        $query->from('product_supplier', 'ps');
        $query->leftJoin('stock', 's', '
			s.id_product = ps.id_product
			AND s.id_product_attribute = ps.id_product_attribute
			AND s.id_warehouse = ' . (int) $supply_order->id_warehouse);
        $query->innerJoin('warehouse_product_location', 'wpl', '
			wpl.id_product = ps.id_product
			AND wpl.id_product_attribute = ps.id_product_attribute
			AND wpl.id_warehouse = ' . (int) $supply_order->id_warehouse . '
		');
        $query->leftJoin('product', 'p', 'p.id_product = ps.id_product');
        $query->leftJoin('product_attribute', 'pa', '
			pa.id_product_attribute = ps.id_product_attribute
			AND p.id_product = ps.id_product
		');
        $query->where('ps.id_supplier = ' . (int) $supply_order->id_supplier);
        // gets items
        $items = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
        // loads order currency
        $order_currency = new Currency($supply_order->id_currency);
        if (!Validate::isLoadedObject($order_currency)) {
            return;
        }
        $manager = StockManagerFactory::getManager();
        foreach ($items as $item) {
            $diff = (int) $threshold;
            if ($supply_order->is_template != 1) {
                $real_quantity = (int) $manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $supply_order->id_warehouse, true);
                $diff = (int) $threshold - (int) $real_quantity;
            }
            if ($diff >= 0) {
                // sets supply_order_detail
                $supply_order_detail = new SupplyOrderDetail();
                $supply_order_detail->id_supply_order = $supply_order->id;
                $supply_order_detail->id_currency = $order_currency->id;
                $supply_order_detail->id_product = $item['id_product'];
                $supply_order_detail->id_product_attribute = $item['id_product_attribute'];
                $supply_order_detail->reference = $item['reference'];
                $supply_order_detail->supplier_reference = $item['supplier_reference'];
                $supply_order_detail->name = Product::getProductName($item['id_product'], $item['id_product_attribute'], $supply_order->id_lang);
                $supply_order_detail->ean13 = $item['ean13'];
                $supply_order_detail->upc = $item['upc'];
                $supply_order_detail->quantity_expected = (int) $diff == 0 ? 1 : (int) $diff;
                $supply_order_detail->exchange_rate = $order_currency->conversion_rate;
                $product_currency = new Currency($item['id_currency']);
                if (Validate::isLoadedObject($product_currency)) {
                    $supply_order_detail->unit_price_te = Tools::convertPriceFull($item['unit_price_te'], $product_currency, $order_currency);
                } else {
                    $supply_order_detail->unit_price_te = 0;
                }
                $supply_order_detail->save();
                unset($product_currency);
            }
        }
        // updates supply order
        $supply_order->update();
    }
开发者ID:zangles,项目名称:lennyba,代码行数:89,代码来源:AdminSupplyOrdersController.php


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