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

PHP PrestaShopCollection类代码示例

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

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



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

示例1: getShopUrls

 /**
  * Get list of shop urls
  *
  * @param bool $id_shop
  * @return PrestaShopCollection Collection of ShopUrl
  */
 public static function getShopUrls($id_shop = false)
 {
     $urls = new PrestaShopCollection('ShopUrl');
     if ($id_shop) {
         $urls->where('id_shop', '=', $id_shop);
     }
     return $urls;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:14,代码来源:ShopUrl.php


示例2: getAllThemes

 public static function getAllThemes($excluded_ids = false)
 {
     $themes = new PrestaShopCollection('Theme');
     if (is_array($excluded_ids) && !empty($excluded_ids)) {
         $themes->where('id_theme', 'notin', $excluded_ids);
     }
     $themes->orderBy('name');
     return $themes;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:9,代码来源:Theme.php


示例3: getShopGroups

 public static function getShopGroups($active = true)
 {
     $groups = new PrestaShopCollection('ShopGroup');
     $groups->where('deleted', '=', false);
     if ($active) {
         $groups->where('active', '=', true);
     }
     return $groups;
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:9,代码来源:ShopGroup.php


示例4: getByInvoiceId

 /**
  * Get Order Payments By Invoice ID
  *
  * @param int $id_invoice Invoice ID
  * @return PrestaShopCollection Collection of OrderPayment
  */
 public static function getByInvoiceId($id_invoice)
 {
     $payments = Db::getInstance()->executeS('SELECT id_order_payment FROM `' . _DB_PREFIX_ . 'order_invoice_payment` WHERE id_order_invoice = ' . (int) $id_invoice);
     if (!$payments) {
         return array();
     }
     $payment_list = array();
     foreach ($payments as $payment) {
         $payment_list[] = $payment['id_order_payment'];
     }
     $payments = new PrestaShopCollection('OrderPayment');
     $payments->where('id_order_payment', 'IN', $payment_list);
     return $payments;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:20,代码来源:OrderPayment.php


示例5: getShopsCollection

 /**
  * Get a collection of shops
  *
  * @param bool $active
  * @param int $id_shop_group
  * @return PrestaShopCollection Collection of Shop
  */
 public static function getShopsCollection($active = true, $id_shop_group = null)
 {
     $shops = new PrestaShopCollection('Shop');
     if ($active) {
         $shops->where('active', '=', 1);
     }
     if ($id_shop_group) {
         $shops->where('id_shop_group', '=', (int) $id_shop_group);
     }
     return $shops;
 }
开发者ID:gks-stage,项目名称:prestashop,代码行数:18,代码来源:Shop.php


示例6: getSibling

 /**
  * Return collection of order invoice object linked to the payments of the current order invoice object
  *
  * @since 1.5.0.14
  * @return PrestaShopCollection|array Collection of OrderInvoice or empty array
  */
 public function getSibling()
 {
     $query = new DbQuery();
     $query->select('oip2.id_order_invoice');
     $query->from('order_invoice_payment', 'oip1');
     $query->innerJoin('order_invoice_payment', 'oip2', 'oip2.id_order_payment = oip1.id_order_payment AND oip2.id_order_invoice <> oip1.id_order_invoice');
     $query->where('oip1.id_order_invoice = ' . $this->id);
     $invoices = Db::getInstance()->executeS($query);
     if (!$invoices) {
         return array();
     }
     $invoice_list = array();
     foreach ($invoices as $invoice) {
         $invoice_list[] = $invoice['id_order_invoice'];
     }
     $payments = new PrestaShopCollection('OrderInvoice');
     $payments->where('id_order_invoice', 'IN', $invoice_list);
     return $payments;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:25,代码来源:OrderInvoice.php


示例7: getBrother

 /**
  * Get all other orders with the same reference
  *
  * @since 1.5.0.13
  */
 public function getBrother()
 {
     $collection = new PrestaShopCollection('order');
     $collection->where('reference', '=', $this->reference);
     $collection->where('id_order', '<>', $this->id);
     return $collection;
 }
开发者ID:TheTypoMaster,项目名称:neotienda,代码行数:12,代码来源:NeoExchanges.php


示例8: getAllParents

 /**
  * Return an array of all parents of the current category
  *
  * @param int $id_lang
  * @return PrestaShopCollection Collection of Category
  */
 public function getAllParents($id_lang = null)
 {
     if (is_null($id_lang)) {
         $id_lang = Context::getContext()->language->id;
     }
     $categories = new PrestaShopCollection('Category', $id_lang);
     $categories->where('nleft', '<', $this->nleft);
     $categories->where('nright', '>', $this->nright);
     return $categories;
 }
开发者ID:yewed,项目名称:share,代码行数:16,代码来源:Category.php


示例9: getCollectionFromModule

 /**
  * Get collection from module name
  * @static
  * @param $module string Module name
  * @param null $id_lang integer Language ID
  * @return array|Collection Collection of tabs (or empty array)
  */
 public static function getCollectionFromModule($module, $id_lang = null)
 {
     if (is_null($id_lang)) {
         $id_lang = Context::getContext()->language->id;
     }
     if (!Validate::isModuleName($module)) {
         return array();
     }
     $tabs = new PrestaShopCollection('Tab', (int) $id_lang);
     $tabs->where('module', '=', $module);
     return $tabs;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:19,代码来源:Tab.php


示例10: assignOrderTracking

 /**
  * Assigns template vars related to order tracking information
  *
  * @param PrestaShopCollection $order_collection
  *
  * @throws PrestaShopException
  */
 protected function assignOrderTracking($order_collection)
 {
     $customer = new Customer((int) $order_collection->getFirst()->id_customer);
     $order_collection = $order_collection->getAll();
     $order_list = array();
     foreach ($order_collection as $order) {
         $order_list[] = $order;
     }
     foreach ($order_list as &$order) {
         /** @var Order $order */
         $order->id_order_state = (int) $order->getCurrentState();
         $order->invoice = OrderState::invoiceAvailable((int) $order->id_order_state) && $order->invoice_number;
         $order->order_history = $order->getHistory((int) $this->context->language->id, false, true);
         $order->carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
         $order->address_invoice = new Address((int) $order->id_address_invoice);
         $order->address_delivery = new Address((int) $order->id_address_delivery);
         $order->inv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_invoice->id_country);
         $order->dlv_adr_fields = AddressFormat::getOrderedAddressFields($order->address_delivery->id_country);
         $order->invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_invoice, $order->inv_adr_fields);
         $order->deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($order->address_delivery, $order->dlv_adr_fields);
         $order->currency = new Currency($order->id_currency);
         $order->discounts = $order->getCartRules();
         $order->invoiceState = Validate::isLoadedObject($order->address_invoice) && $order->address_invoice->id_state ? new State((int) $order->address_invoice->id_state) : false;
         $order->deliveryState = Validate::isLoadedObject($order->address_delivery) && $order->address_delivery->id_state ? new State((int) $order->address_delivery->id_state) : false;
         $order->products = $order->getProducts();
         $order->customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
         Product::addCustomizationPrice($order->products, $order->customizedDatas);
         $order->total_old = $order->total_discounts > 0 ? (double) $order->total_paid - (double) $order->total_discounts : false;
         if ($order->carrier->url && $order->shipping_number) {
             $order->followup = str_replace('@', $order->shipping_number, $order->carrier->url);
         }
         $order->hook_orderdetaildisplayed = Hook::exec('displayOrderDetail', array('order' => $order));
         Hook::exec('actionOrderDetail', array('carrier' => $order->carrier, 'order' => $order));
     }
     $this->context->smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order_collection' => $order_list, 'return_allowed' => false, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'use_tax' => Configuration::get('PS_TAX')));
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:43,代码来源:GuestTrackingController.php


示例11: getCollection

 /**
  * For a given product, gets its warehouses
  *
  * @param int $id_product
  * @return PrestaShopCollection The type of the collection is WarehouseProductLocation
  */
 public static function getCollection($id_product)
 {
     $collection = new PrestaShopCollection('WarehouseProductLocation');
     $collection->where('id_product', '=', (int) $id_product);
     return $collection;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:12,代码来源:WarehouseProductLocation.php


示例12: deleteByIdCustomer

 /**
  * @static
  * @param $id_customer
  * @return bool
  */
 public static function deleteByIdCustomer($id_customer)
 {
     $return = true;
     $cart_rules = new PrestaShopCollection('CartRule');
     $cart_rules->where('id_customer', '=', $id_customer);
     foreach ($cart_rules as $cart_rule) {
         $return &= $cart_rule->delete();
     }
     return $return;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:15,代码来源:CartRule.php


示例13: renderCSV

 /**
  * Exports CSV
  */
 protected function renderCSV()
 {
     // exports orders
     if (Tools::isSubmit('csv_orders')) {
         $ids = array();
         foreach ($this->_list as $entry) {
             $ids[] = $entry['id_supply_order'];
         }
         if (count($ids) <= 0) {
             return;
         }
         $id_lang = Context::getContext()->language->id;
         $orders = new PrestaShopCollection('SupplyOrder', $id_lang);
         $orders->where('is_template', '=', false);
         $orders->where('id_supply_order', 'in', $ids);
         $id_warehouse = $this->getCurrentWarehouse();
         if ($id_warehouse != -1) {
             $orders->where('id_warehouse', '=', $id_warehouse);
         }
         $orders->getAll();
         $csv = new CSV($orders, $this->l('supply_orders'));
         $csv->export();
     } elseif (Tools::isSubmit('csv_orders_details')) {
         // header
         header('Content-type: text/csv');
         header('Content-Type: application/force-download; charset=UTF-8');
         header('Cache-Control: no-store, no-cache');
         header('Content-disposition: attachment; filename="' . $this->l('supply_orders_details') . '.csv"');
         // echoes details
         $ids = array();
         foreach ($this->_list as $entry) {
             $ids[] = $entry['id_supply_order'];
         }
         if (count($ids) <= 0) {
             return;
         }
         // for each supply order
         $keys = array('id_product', 'id_product_attribute', 'reference', 'supplier_reference', 'ean13', 'upc', 'name', 'unit_price_te', 'quantity_expected', 'quantity_received', 'price_te', 'discount_rate', 'discount_value_te', 'price_with_discount_te', 'tax_rate', 'tax_value', 'price_ti', 'tax_value_with_order_discount', 'price_with_order_discount_te', 'id_supply_order');
         echo sprintf("%s\n", implode(';', array_map(array('CSVCore', 'wrap'), $keys)));
         // overrides keys (in order to add FORMAT calls)
         $keys = array('sod.id_product', 'sod.id_product_attribute', 'sod.reference', 'sod.supplier_reference', 'sod.ean13', 'sod.upc', 'sod.name', 'FORMAT(sod.unit_price_te, 2)', 'sod.quantity_expected', 'sod.quantity_received', 'FORMAT(sod.price_te, 2)', 'FORMAT(sod.discount_rate, 2)', 'FORMAT(sod.discount_value_te, 2)', 'FORMAT(sod.price_with_discount_te, 2)', 'FORMAT(sod.tax_rate, 2)', 'FORMAT(sod.tax_value, 2)', 'FORMAT(sod.price_ti, 2)', 'FORMAT(sod.tax_value_with_order_discount, 2)', 'FORMAT(sod.price_with_order_discount_te, 2)', 'sod.id_supply_order');
         foreach ($ids as $id) {
             $query = new DbQuery();
             $query->select(implode(', ', $keys));
             $query->from('supply_order_detail', 'sod');
             $query->leftJoin('supply_order', 'so', 'so.id_supply_order = sod.id_supply_order');
             $id_warehouse = $this->getCurrentWarehouse();
             if ($id_warehouse != -1) {
                 $query->where('so.id_warehouse = ' . (int) $id_warehouse);
             }
             $query->where('sod.id_supply_order = ' . (int) $id);
             $query->orderBy('sod.id_supply_order_detail DESC');
             $resource = Db::getInstance()->query($query);
             // gets details
             while ($row = Db::getInstance()->nextRow($resource)) {
                 echo sprintf("%s\n", implode(';', array_map(array('CSVCore', 'wrap'), $row)));
             }
         }
     } elseif (Tools::isSubmit('csv_order_details') && Tools::getValue('id_supply_order')) {
         $supply_order = new SupplyOrder((int) Tools::getValue('id_supply_order'));
         if (Validate::isLoadedObject($supply_order)) {
             $details = $supply_order->getEntriesCollection();
             $details->getAll();
             $csv = new CSV($details, $this->l('supply_order') . '_' . $supply_order->reference . '_details');
             $csv->export();
         }
     }
 }
开发者ID:zangles,项目名称:lennyba,代码行数:71,代码来源:AdminSupplyOrdersController.php


示例14: deleteDownload

 /**
  * Remove all downloadable files for product and its attributes
  *
  * @return bool
  */
 public function deleteDownload()
 {
     $result = true;
     $collection_download = new PrestaShopCollection('ProductDownload');
     $collection_download->where('id_product', '=', $this->id);
     foreach ($collection_download as $product_download) {
         /** @var ProductDownload $product_download */
         $result &= $product_download->delete($product_download->checkFile());
     }
     return $result;
 }
开发者ID:yewed,项目名称:share,代码行数:16,代码来源:Product.php


示例15: getSupplierCollection

 /**
  * For a given product, retrieves its suppliers
  *
  * @param int $id_product
  * @param int $group_by_supplier
  * @return Collection
  */
 public static function getSupplierCollection($id_product, $group_by_supplier = true)
 {
     $suppliers = new PrestaShopCollection('ProductSupplier');
     $suppliers->where('id_product', '=', (int) $id_product);
     if ($group_by_supplier) {
         $suppliers->groupBy('id_supplier');
     }
     return $suppliers;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:16,代码来源:ProductSupplier.php


示例16: getStockCollection

 /**
  * For a given product, retrieves the stock collection
  *
  * @param int $id_product
  * @param int $id_product_attribute
  * @param int $id_warehouse Optional
  * @param int $price_te Optional
  * @return PrestaShopCollection Collection of Stock
  */
 protected function getStockCollection($id_product, $id_product_attribute, $id_warehouse = null, $price_te = null)
 {
     $stocks = new PrestaShopCollection('Stock');
     $stocks->where('id_product', '=', $id_product);
     $stocks->where('id_product_attribute', '=', $id_product_attribute);
     if ($id_warehouse) {
         $stocks->where('id_warehouse', '=', $id_warehouse);
     }
     if ($price_te) {
         $stocks->where('price_te', '=', $price_te);
     }
     return $stocks;
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:22,代码来源:StockManager.php


示例17: getEntriesCollection

 /**
  * Retrieves the details entries (i.e. products) collection for the current order
  *
  * @return PrestaShopCollection Collection of SupplyOrderDetail
  */
 public function getEntriesCollection()
 {
     $details = new PrestaShopCollection('SupplyOrderDetail');
     $details->where('id_supply_order', '=', $this->id);
     return $details;
 }
开发者ID:zangles,项目名称:lennyba,代码行数:11,代码来源:SupplyOrder.php


示例18: getThemes

 public static function getThemes()
 {
     $themes = new PrestaShopCollection('Theme');
     $themes->orderBy('name');
     return $themes;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:6,代码来源:Theme.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP PrestaShopLogger类代码示例发布时间:2022-05-23
下一篇:
PHP Presscore_Config类代码示例发布时间: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