本文整理汇总了PHP中SpecificPrice::getProductIdByDate方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecificPrice::getProductIdByDate方法的具体用法?PHP SpecificPrice::getProductIdByDate怎么用?PHP SpecificPrice::getProductIdByDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecificPrice
的用法示例。
在下文中一共展示了SpecificPrice::getProductIdByDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getProductIdByDate
protected static function _getProductIdByDate($beginning, $ending)
{
global $cookie, $cart;
$id_group = $cookie->id_customer ? (int) Customer::getDefaultGroupId((int) $cookie->id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
$id_address = $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
$ids = Address::getCountryAndState($id_address);
$id_country = (int) ($ids['id_country'] ? $ids['id_country'] : Configuration::get('PS_COUNTRY_DEFAULT'));
return SpecificPrice::getProductIdByDate((int) Shop::getCurrentShop(), (int) $cookie->id_currency, $id_country, $id_group, $beginning, $ending);
}
示例2: _getProductIdByDate
protected function _getProductIdByDate($beginning, $ending, Context $context = null, $with_combination = false)
{
if (!$context) {
$context = Context::getContext();
}
$id_address = $context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
$ids = Address::getCountryAndState($id_address);
$id_country = (int) ($ids['id_country'] ? $ids['id_country'] : Configuration::get('PS_COUNTRY_DEFAULT'));
return SpecificPrice::getProductIdByDate($context->shop->id, $context->currency->id, $id_country, $context->customer->id_default_group, $beginning, $ending, 0, $with_combination);
}
示例3: _getPricesDropProductsIds
private function _getPricesDropProductsIds()
{
$sqlGroups = '';
if (version_compare(_PS_VERSION_, '1.6.0.0', '>=') && Group::isFeatureActive() && version_compare(_PS_VERSION_, '1.6.0.0', '<')) {
$currentGroups = FrontController::getCurrentCustomerGroups();
$sqlGroups = 'AND cg.`id_group` ' . (is_array($currentGroups) && sizeof($currentGroups) ? 'IN (' . implode(',', $currentGroups) . ')' : '= 1');
}
$currentDate = date('Y-m-d H:i:s');
if (version_compare(_PS_VERSION_, '1.5.0.0', '<')) {
global $cookie, $cart;
$id_group = $cookie->id_customer ? (int) Customer::getDefaultGroupId((int) $cookie->id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
$id_address = $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
$ids = Address::getCountryAndState($id_address);
$id_country = (int) ($ids['id_country'] ? $ids['id_country'] : Configuration::get('PS_COUNTRY_DEFAULT'));
$ids_product = SpecificPrice::getProductIdByDate((int) Shop::getCurrentShop(), (int) $cookie->id_currency, $id_country, $id_group, $currentDate, $currentDate);
} else {
$id_address = $this->_context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
$ids = Address::getCountryAndState($id_address);
$id_country = (int) ($ids['id_country'] ? $ids['id_country'] : Configuration::get('PS_COUNTRY_DEFAULT'));
$ids_product = SpecificPrice::getProductIdByDate($this->_context->shop->id, $this->_context->currency->id, $id_country, $this->_context->customer->id_default_group, $currentDate, $currentDate, 0, false);
}
$tab_id_product = array();
foreach ($ids_product as $product) {
if (is_array($product)) {
$tab_id_product[] = (int) $product['id_product'];
} else {
$tab_id_product[] = (int) $product;
}
}
Db::getInstance()->Execute('SET group_concat_max_len := @@max_allowed_packet');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT GROUP_CONCAT(p.id_product) as pid_list
FROM `' . _DB_PREFIX_ . 'product` p
' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Shop::addSqlAssociation('product', 'p') : '') . '
WHERE ' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? 'product_shop' : 'p') . '.`active` = 1
AND ' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? 'product_shop' : 'p') . '.`show_price` = 1
' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? ' AND product_shop.`visibility` IN ("both", "catalog") ' : '') . '
AND ' . (version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? 'product_shop' : 'p') . '.`id_product` IN (' . (is_array($tab_id_product) && count($tab_id_product) ? implode(', ', $tab_id_product) : 0) . ')
AND p.`id_product` IN (
SELECT cp.`id_product`
FROM `' . _DB_PREFIX_ . 'category_group` cg
LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` ' . $sqlGroups . '
)');
if ($result && isset($result['pid_list']) && !empty($result['pid_list'])) {
return explode(',', $result['pid_list']);
}
return array(0);
}