本文整理汇总了PHP中ObjectModel::updateMultishopTable方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectModel::updateMultishopTable方法的具体用法?PHP ObjectModel::updateMultishopTable怎么用?PHP ObjectModel::updateMultishopTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectModel
的用法示例。
在下文中一共展示了ObjectModel::updateMultishopTable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeUpdateOptions
public function beforeUpdateOptions()
{
if (!Tools::getValue('PS_STOCK_MANAGEMENT')) {
$_POST['PS_ORDER_OUT_OF_STOCK'] = 1;
$_POST['PS_DISPLAY_QTIES'] = 0;
}
// if advanced stock management is disabled, updates concerned tables
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 1 && (int) Tools::getValue('PS_ADVANCED_STOCK_MANAGEMENT') == 0) {
ObjectModel::updateMultishopTable('Product', array('advanced_stock_management' => 0), 'product_shop.`advanced_stock_management` = 1');
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'stock_available`
SET `depends_on_stock` = 0, `quantity` = 0
WHERE `depends_on_stock` = 1');
}
}
示例2: beforeUpdateOptions
public function beforeUpdateOptions()
{
if (!Tools::getValue('PS_STOCK_MANAGEMENT', true)) {
$_POST['PS_ORDER_OUT_OF_STOCK'] = 1;
$_POST['PS_DISPLAY_QTIES'] = 0;
}
// if advanced stock management is disabled, updates concerned tables
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 1 && (int) Tools::getValue('PS_ADVANCED_STOCK_MANAGEMENT') == 0 && Context::getContext()->shop->getContext() == Shop::CONTEXT_ALL) {
ObjectModel::updateMultishopTable('Product', array('advanced_stock_management' => 0), 'product_shop.`advanced_stock_management` = 1');
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'stock_available`
SET `depends_on_stock` = 0, `quantity` = 0
WHERE `depends_on_stock` = 1');
}
if (Tools::getIsset('PS_CATALOG_MODE')) {
Tools::clearSmartyCache();
Media::clearCache();
}
}
示例3: setProductsAsIndexed
protected static function setProductsAsIndexed(&$products)
{
if (count($products)) {
ObjectModel::updateMultishopTable('Product', array('indexed' => 1), 'a.id_product IN (' . implode(',', $products) . ')');
}
}
示例4: setProducts
public function setProducts($array)
{
$result = Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'product_tag WHERE id_tag = ' . (int) $this->id);
if (is_array($array)) {
$array = array_map('intval', $array);
$result &= ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'a.id_product IN (' . implode(',', $array) . ')');
$ids = array();
foreach ($array as $id_product) {
$ids[] = '(' . (int) $id_product . ',' . (int) $this->id . ')';
}
if ($result) {
$result &= Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'product_tag (id_product, id_tag) VALUES ' . implode(',', $ids));
if (Configuration::get('PS_SEARCH_INDEXATION')) {
$result &= Search::indexation(false);
}
}
}
return $result;
}
示例5: updateOptionPsCurrencyDefault
public function updateOptionPsCurrencyDefault($value)
{
if ($value == Configuration::get('PS_CURRENCY_DEFAULT')) {
return;
}
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
/* Set conversion rate of default currency to 1 */
ObjectModel::updateMultishopTable('Currency', array('conversion_rate' => 1), 'a.id_currency');
$tmp_context = Shop::getContext();
if ($tmp_context == Shop::CONTEXT_GROUP) {
$tmp_shop = Shop::getContextShopGroupID();
} else {
$tmp_shop = (int) Shop::getContextShopID();
}
foreach (Shop::getContextListShopID() as $id_shop) {
Shop::setContext(Shop::CONTEXT_SHOP, (int) $id_shop);
Currency::refreshCurrencies();
}
Shop::setContext($tmp_context, $tmp_shop);
}
示例6: resetEcoTax
public static function resetEcoTax()
{
return ObjectModel::updateMultishopTable('product', array('ecotax' => 0), '');
}
示例7: updateOptionPsCurrencyDefault
public function updateOptionPsCurrencyDefault($value)
{
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
/* Set conversion rate of default currency to 1 */
ObjectModel::updateMultishopTable('Currency', array('conversion_rate' => 1), 'a.id_currency');
Currency::refreshCurrencies();
}
示例8: addOrder
/**
* @param ShopgateOrder $order
*
* @return array
* @throws PrestaShopException
* @throws ShopgateLibraryException
*/
public function addOrder(ShopgateOrder $order)
{
/**
* check exits shopgate order
*/
if (ShopgateOrderPrestashop::loadByOrderNumber($order->getOrderNumber())->status == 1) {
throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_DUPLICATE_ORDER, sprintf('external_order_id: %s', $order->getOrderNumber()), true);
}
/** @var CarrierCore $sgCarrier */
$sgCarrier = new Carrier(Configuration::get('SG_CARRIER_ID'));
if (version_compare(_PS_VERSION_, '1.5.0', '<') && empty($sgCarrier->name)) {
$sgCarrier->name = 'shopgate_tmp_carrier';
}
if ($order->getShippingType() != ShopgateShipping::DEFAULT_PLUGIN_API_KEY) {
if ($order->getShippingInfos()->getAmount() > 0) {
if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
ShopgateModObjectModel::updateShippingPrice(pSQL($order->getShippingInfos()->getAmount()));
} else {
$data = array('price' => pSQL($order->getShippingInfos()->getAmount()));
$where = 'a.id_carrier = ' . (int) Configuration::get('SG_CARRIER_ID');
ObjectModel::updateMultishopTable('Delivery', $data, $where);
}
$sgCarrier->is_free = 0;
} else {
$sgCarrier->is_free = 1;
}
}
$sgCarrier->update();
$customerModel = new ShopgateItemsCustomerImportJson($this->getPlugin());
$paymentModel = new ShopgatePayment($this->getModule());
$shippingModel = new ShopgateShipping($this->getModule());
/**
* read / check customer
*/
if (!($customerId = Customer::customerExists($order->getMail(), true, false))) {
/**
* prepare customer
*/
$shopgateCustomerItem = new ShopgateCustomer();
$shopgateCustomerItem->setLastName($order->getInvoiceAddress()->getLastName());
$shopgateCustomerItem->setFirstName($order->getInvoiceAddress()->getFirstName());
$shopgateCustomerItem->setGender($order->getInvoiceAddress()->getGender());
$shopgateCustomerItem->setBirthday($order->getInvoiceAddress()->getBirthday());
$shopgateCustomerItem->setNewsletterSubscription(Configuration::get('SG_SUBSCRIBE_NEWSLETTER') ? true : false);
$customerId = $customerModel->registerCustomer($order->getMail(), md5(_COOKIE_KEY_ . time()), $shopgateCustomerItem);
}
/** @var CustomerCore $customer */
$customer = new Customer($customerId);
/**
* prepare cart
*/
if (!$order->getDeliveryAddress()->getPhone()) {
$order->getDeliveryAddress()->setPhone($order->getPhone());
}
if (!$order->getInvoiceAddress()->getPhone()) {
$order->getInvoiceAddress()->setPhone($order->getPhone());
}
$this->getCart()->id_address_delivery = $customerModel->createAddress($order->getDeliveryAddress(), $customer);
$this->getCart()->id_address_invoice = $customerModel->createAddress($order->getInvoiceAddress(), $customer);
$this->getCart()->id_customer = $customerId;
// id_guest is a connection to a ps_guest entry which includes screen width etc.
// is_guest field only exists in Prestashop 1.4.1.0 and higher
if (version_compare(_PS_VERSION_, '1.4.1.0', '>=')) {
$this->getCart()->id_guest = $customer->is_guest;
}
$this->getCart()->secure_key = $customer->secure_key;
$this->getCart()->id_carrier = $shippingModel->getCarrierIdByApiOrder($order);
$shopgateCustomFieldsHelper = new ShopgateCustomFieldsHelper();
$shopgateCustomFieldsHelper->saveCustomFields($this->getCart(), $order->getCustomFields());
$this->getCart()->add();
/**
* add cart items
*/
$canCreateOrder = true;
$errorMessages = array();
foreach ($order->getItems() as $item) {
list($productId, $attributeId) = ShopgateHelper::getProductIdentifiers($item);
if ($productId == 0) {
continue;
}
$updateCart = $this->getCart()->updateQty($item->getQuantity(), $productId, $attributeId, false, 'up', $this->getCart()->id_address_delivery);
if ($updateCart !== true) {
$canCreateOrder = false;
$errorMessages[] = array('product_id' => $productId, 'attribute_id' => $attributeId, 'quantity' => $item->getQuantity(), 'result' => $updateCart, 'reason' => $updateCart == -1 ? 'minimum quantity not reached' : '');
}
}
/**
* coupons
*/
foreach ($order->getExternalCoupons() as $coupon) {
/** @var CartRuleCore $cartRule */
$cartRule = new CartRule(CartRule::getIdByCode($coupon->getCode()));
if (Validate::isLoadedObject($cartRule)) {
//.........这里部分代码省略.........
示例9: checkDefaultAttributes
/**
* Check if there is no default attribute and create it if not
*/
public function checkDefaultAttributes()
{
if (!$this->product_id) {
return false;
}
$db = JFactory::getDBO();
$query = "SELECT COUNT(*) FROM " . $db->quoteName('#__jeproshop_product_attribute') . " AS product_attribute " . JeproshopShopModelShop::addSqlRestriction('product_attribute') . " WHERE product_attribute_shop.";
$query .= $db->quoteName('default_on') . " = 1 AND product_attribute_attribute." . $db->quoteName('product_id') . " = " . (int) $this->product_id;
$db->setQuery($query);
if ($db->loadResult() > 1) {
/*$query = "UPDATE " . $db->quoteName('#__jeproshop_product_attribute_shop') . " SET " . $db->quoteName('default_on') . " WHERE " . $db->quoteName('product_attribute_id'), ' . _DB_PREFIX_ . 'product_attribute pa
SET product_attribute_shop.default_on=0, pa.default_on = 0
WHERE product_attribute_shop.id_product_attribute=pa.id_product_attribute AND pa.id_product=' . (int)$this->id
. Shop::addSqlRestriction(false, 'product_attribute_shop'));
$db->setQuery($query);
$db->query();*/
}
$query = "SELECT product_attribute." . $db->quoteName('product_id') . " FROM " . $db->quoteName('#__jeproshop_product_attribute') . " AS product_attribute " . JeproshopShopModelShop::addSqlAssociation('product_attribute');
$query .= " WHERE product_attribute_shop." . $db->quoteName('default_on') . " = 1 AND product_attribute." . $db->quoteName('product_id') . " = " . (int) $this->product_id;
$db->setQuery($query);
$row = $db->loadObject();
if ($row) {
return true;
}
$query = "SELECT MIN (product_attribute." . $db->quoteName('product_attribute_id') . ") AS attribute_id FROM " . $db->quoteName('#__jeproshop_product_attribute') . " AS product_attribute WHERE " . $db->quoteName('product_id') . " = " . (int) $this->product_id;
$db->setQuery($query);
$mini = $db->loadObject();
if (!$mini) {
return false;
}
if (!ObjectModel::updateMultishopTable('Combination', array('default_on' => 1), 'a.id_product_attribute = ' . (int) $mini['id_attr'])) {
return false;
}
return true;
}