本文整理汇总了PHP中Mage_Core_Model_Store::getWebsiteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Store::getWebsiteId方法的具体用法?PHP Mage_Core_Model_Store::getWebsiteId怎么用?PHP Mage_Core_Model_Store::getWebsiteId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Store
的用法示例。
在下文中一共展示了Mage_Core_Model_Store::getWebsiteId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
/**
* Calculate item fixed tax and prepare information for discount and recular taxation
*
* @param Mage_Sales_Model_Quote_Address $address
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @return Mage_Weee_Model_Total_Quote_Weee
*/
protected function _process(Mage_Sales_Model_Quote_Address $address, $item)
{
if (!$this->_helper->isEnabled($this->_store)) {
return $this;
}
$attributes = $this->_helper->getProductWeeeAttributes($item->getProduct(), $address, $address->getQuote()->getBillingAddress(), $this->_store->getWebsiteId());
$applied = array();
$productTaxes = array();
$totalValue = 0;
$baseTotalValue = 0;
$totalRowValue = 0;
$baseTotalRowValue = 0;
$totalExclTaxValue = 0;
$baseTotalExclTaxValue = 0;
$totalExclTaxRowValue = 0;
$baseTotalExclTaxRowValue = 0;
$customerRatePercentage = $this->_customerRatePercent($address, $item);
foreach ($attributes as $k => $attribute) {
$baseValue = $attribute->getAmount();
$baseValueExclTax = $baseValue;
if ($customerRatePercentage && $this->_helper->isTaxIncluded($this->_store)) {
//Remove the customer tax. This in general applies to EU scenario
$baseValueExclTax = $this->_getCalculator()->round($baseValue * 100 / (100 + $customerRatePercentage));
}
$value = $this->_store->convertPrice($baseValue);
$rowValue = $value * $item->getTotalQty();
$baseRowValue = $baseValue * $item->getTotalQty();
//Get the values excluding tax
$valueExclTax = $this->_store->convertPrice($baseValueExclTax);
$rowValueExclTax = $valueExclTax * $item->getTotalQty();
$baseRowValueExclTax = $baseValueExclTax * $item->getTotalQty();
$title = $attribute->getName();
//Calculate the Wee value
$totalValue += $value;
$baseTotalValue += $baseValue;
$totalRowValue += $rowValue;
$baseTotalRowValue += $baseRowValue;
//Calculate the Wee without tax
$totalExclTaxValue += $valueExclTax;
$baseTotalExclTaxValue += $baseValueExclTax;
$totalExclTaxRowValue += $rowValueExclTax;
$baseTotalExclTaxRowValue += $baseRowValueExclTax;
/*
* Note: including Tax does not necessarily mean it includes all the tax
* *_incl_tax only holds the tax associated with Tax included products
*/
$productTaxes[] = array('title' => $title, 'base_amount' => $baseValueExclTax, 'amount' => $valueExclTax, 'row_amount' => $rowValueExclTax, 'base_row_amount' => $baseRowValueExclTax, 'base_amount_incl_tax' => $baseValue, 'amount_incl_tax' => $value, 'row_amount_incl_tax' => $rowValue, 'base_row_amount_incl_tax' => $baseRowValue);
$applied[] = array('id' => $attribute->getCode(), 'percent' => null, 'hidden' => $this->_helper->includeInSubtotal($this->_store), 'rates' => array(array('base_real_amount' => $baseRowValue, 'base_amount' => $baseRowValue, 'amount' => $rowValue, 'code' => $attribute->getCode(), 'title' => $title, 'percent' => null, 'position' => 1, 'priority' => -1000 + $k)));
}
//We set the TAX exclusive value
$item->setWeeeTaxAppliedAmount($totalExclTaxValue);
$item->setBaseWeeeTaxAppliedAmount($baseTotalExclTaxValue);
$item->setWeeeTaxAppliedRowAmount($totalExclTaxRowValue);
$item->setBaseWeeeTaxAppliedRowAmount($baseTotalExclTaxRowValue);
$this->_processTaxSettings($item, $totalExclTaxValue, $baseTotalExclTaxValue, $totalExclTaxRowValue, $baseTotalExclTaxRowValue)->_processTotalAmount($address, $totalExclTaxRowValue, $baseTotalExclTaxRowValue);
$this->_helper->setApplied($item, array_merge($this->_helper->getApplied($item), $productTaxes));
if ($applied) {
$this->_saveAppliedTaxes($address, $applied, $item->getWeeeTaxAppliedAmount(), $item->getBaseWeeeTaxAppliedAmount(), null);
}
}
示例2: executeByStore
/**
* Create inherited child configurations for a Store
*
* @param Mage_Core_Model_Store $store
*
* @return Payone_Core_Model_Domain_Config_PaymentMethod[]
*/
public function executeByStore(Mage_Core_Model_Store $store)
{
$scope = 'stores';
$scopeId = $store->getStoreId();
$parentId = $store->getWebsiteId();
$this->savePaymentConfigs($scope, $scopeId, $parentId);
}
示例3: _process
/**
* Calculate item fixed tax and prepare information for discount and recular taxation
*
* @param Mage_Sales_Model_Quote_Address $address
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @return Mage_Weee_Model_Total_Quote_Weee
*/
protected function _process(Mage_Sales_Model_Quote_Address $address, $item)
{
if (!$this->_helper->isEnabled($this->_store)) {
return $this;
}
$attributes = $this->_helper->getProductWeeeAttributes($item->getProduct(), $address, $address->getQuote()->getBillingAddress(), $this->_store->getWebsiteId());
$applied = array();
$productTaxes = array();
$totalValue = 0;
$baseTotalValue = 0;
$totalRowValue = 0;
$baseTotalRowValue = 0;
foreach ($attributes as $k => $attribute) {
$baseValue = $attribute->getAmount();
$value = $this->_store->convertPrice($baseValue);
$rowValue = $value * $item->getTotalQty();
$baseRowValue = $baseValue * $item->getTotalQty();
$title = $attribute->getName();
$totalValue += $value;
$baseTotalValue += $baseValue;
$totalRowValue += $rowValue;
$baseTotalRowValue += $baseRowValue;
$productTaxes[] = array('title' => $title, 'base_amount' => $baseValue, 'amount' => $value, 'row_amount' => $rowValue, 'base_row_amount' => $baseRowValue, 'base_amount_incl_tax' => $baseValue, 'amount_incl_tax' => $value, 'row_amount_incl_tax' => $rowValue, 'base_row_amount_incl_tax' => $baseRowValue);
$applied[] = array('id' => $attribute->getCode(), 'percent' => null, 'hidden' => $this->_helper->includeInSubtotal($this->_store), 'rates' => array(array('base_real_amount' => $baseRowValue, 'base_amount' => $baseRowValue, 'amount' => $rowValue, 'code' => $attribute->getCode(), 'title' => $title, 'percent' => null, 'position' => 1, 'priority' => -1000 + $k)));
}
$item->setWeeeTaxAppliedAmount($totalValue)->setBaseWeeeTaxAppliedAmount($baseTotalValue)->setWeeeTaxAppliedRowAmount($totalRowValue)->setBaseWeeeTaxAppliedRowAmount($baseTotalRowValue);
$this->_processTaxSettings($item, $totalValue, $baseTotalValue, $totalRowValue, $baseTotalRowValue)->_processTotalAmount($address, $totalRowValue, $baseTotalRowValue);
$this->_helper->setApplied($item, array_merge($this->_helper->getApplied($item), $productTaxes));
if ($applied) {
$this->_saveAppliedTaxes($address, $applied, $item->getWeeeTaxAppliedAmount(), $item->getBaseWeeeTaxAppliedAmount(), null);
}
}
示例4: _flushAllSpecialPrices
/**
* @param Mage_Core_Model_Store $store
*/
protected function _flushAllSpecialPrices($store)
{
/** @var Mage_Catalog_Model_Resource_Product_Collection $products */
$products = Mage::getResourceModel('catalog/product_collection')->setStoreId($store->getId())->addAttributeToFilter('special_from_date', array('lteq' => now(true)))->addAttributeToFilter(array(array('attribute' => 'special_to_date', 'gteq' => now(true)), array('attribute' => 'special_to_date', 'null' => true)))->addWebsiteFilter($store->getWebsiteId());
$size = $products->getSize();
if ($size) {
$msg = sprintf('process store %s and %s product(s) with all special prices', $store->getCode(), $size);
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array(array($this, 'iteratorCallback')), array('size' => $size, 'msg' => $msg, 'store' => $store));
echo PHP_EOL;
}
}
示例5: getAmounts
/**
* Get amounts by product and store
*
* @param int $product
* @param Mage_Core_Model_Store $store
* @return array
*/
public function getAmounts($product, $store)
{
$isGlobal = $store->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE) == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL;
if ($isGlobal) {
$key = $product;
} else {
$website = $store->getWebsiteId();
$key = "{$product}|{$website}";
}
$read = $this->_getReadAdapter();
if (!isset($this->_cache[$key])) {
$select = $read->select()->from($this->getTable('enterprise_giftcard/amount'), array('value', 'website_id'))->where('entity_id = ?', $product);
$bind = array('product_id' => $product);
if ($isGlobal) {
$select->where('website_id = 0');
} else {
$select->where('website_id IN (0, :website_id)');
$bind['website_id'] = $website;
}
$fetched = $read->fetchAll($select, $bind);
$this->_cache[$key] = $this->_convertPrices($fetched, $store);
}
return $this->_cache[$key];
}
示例6: _initStoreView
/**
* Init Staging Store Views
*
* @param Varien_Data_Form $fieldset
* @param Mage_Core_Model_Store $storeView
* @param Mage_Core_Model_Website $stagingWebsite
* @return Enterprise_Staging_Block_Manage_Staging_Edit_Tabs_Website
*/
protected function _initStoreView($fieldset, $storeView, $stagingWebsite = null)
{
$_shift = str_repeat(' ', 6);
if (!$stagingWebsite) {
$_id = $storeView->getId();
$websiteId = $storeView->getWebsiteId();
$fieldset->addField('master_store_use_' . $_id, 'checkbox', array('label' => $_shift . $storeView->getName(), 'name' => "websites[{$websiteId}][stores][{$_id}][use]", 'value' => $storeView->getId(), 'checked' => true));
$fieldset->addField('master_store_id_' . $_id, 'hidden', array('label' => Mage::helper('enterprise_staging')->__('Master Store ID'), 'name' => "websites[{$websiteId}][stores][{$_id}][master_store_id]", 'value' => $storeView->getId()));
$fieldset->addField('master_store_code_' . $_id, 'hidden', array('label' => Mage::helper('enterprise_staging')->__('Master Store Code'), 'name' => "websites[{$websiteId}][stores][{$_id}][master_store_code]", 'value' => $storeView->getCode()));
$fieldset->addField('staging_store_code_' . $_id, 'hidden', array('label' => Mage::helper('enterprise_staging')->__('Staging Store Code'), 'name' => "websites[{$websiteId}][stores][{$_id}][code]", 'value' => Mage::helper('enterprise_staging/store')->generateStoreCode($storeView->getCode())));
$fieldset->addField('staging_store_name_' . $_id, 'hidden', array('label' => Mage::helper('enterprise_staging')->__('Staging Store Name'), 'name' => "websites[{$websiteId}][stores][{$_id}][name]", 'value' => $storeView->getName()));
} else {
$fieldset->addField('staging_store_' . $storeView->getId(), 'label', array('label' => $_shift . $storeView->getName()));
}
return $this;
}
示例7: getTierPrices
/**
* Return tier data for specified products in specified store
*
* @param array $products
* @param Mage_Core_Model_Store $store
* @return mixed
*/
public function getTierPrices($products, $store)
{
return $this->getResource()->getTierPrices($products, $store->getWebsiteId());
}
示例8: _customerIsInStore
/**
* Check whether we need to create new customer (for another website) during order creation
*
* @param Mage_Core_Model_Store $store
* @return boolean
*/
protected function _customerIsInStore($store)
{
$customer = $this->getSession()->getCustomer();
if ($customer->getWebsiteId() == $store->getWebsiteId()) {
return true;
}
return $customer->isInStore($store);
}
示例9: reindexTiers
/**
* Reindex data for tier prices
*
* @param array $products array of product ids
* @param Mage_Core_Model_Store $store
* @param int | null $forcedId identifier of "parent" product
*
* @return Mage_CatalogIndex_Model_Mysql4_Indexer
*/
public function reindexTiers($products, $store, $forcedId = null)
{
$websiteId = $store->getWebsiteId();
$attribute = Mage::getSingleton('eav/entity_attribute')->getIdByCode('catalog_product', 'tier_price');
$this->_beginInsert('catalogindex/price', array('entity_id', 'attribute_id', 'value', 'website_id', 'customer_group_id', 'qty'));
/**
* Get information about product types
* array (
* $productType => array()
* )
*/
$products = Mage::getSingleton('catalogindex/retreiver')->assignProductTypes($products);
if (is_null($forcedId)) {
foreach ($products as $type => $typeIds) {
$retreiver = Mage::getSingleton('catalogindex/retreiver')->getRetreiver($type);
if ($retreiver->areChildrenIndexable(Mage_CatalogIndex_Model_Retreiver::CHILDREN_FOR_TIERS)) {
foreach ($typeIds as $id) {
$children = $retreiver->getChildProductIds($store, $id);
if ($children) {
$this->reindexTiers($children, $store, $id);
}
}
}
}
}
$attributeIndex = $this->getTierData($products, $store);
foreach ($attributeIndex as $index) {
$type = $index['type_id'];
$id = is_null($forcedId) ? $index['entity_id'] : $forcedId;
if ($id && $index['value']) {
if ($index['all_groups'] == 1) {
foreach (Mage::getSingleton('catalogindex/retreiver')->getCustomerGroups() as $group) {
$this->_insert('catalogindex/price', array($id, $attribute, $index['value'], $websiteId, (int) $group->getId(), (int) $index['qty']));
}
} else {
$this->_insert('catalogindex/price', array($id, $attribute, $index['value'], $websiteId, (int) $index['customer_group_id'], (int) $index['qty']));
}
}
}
$this->_commitInsert('catalogindex/price');
return $this;
}
示例10: _processStoreCredit
/**
* @param Bronto_Api_Contact_Row $brontoContact
* @param Mage_Customer_Model_Customer $customer
* @param Mage_Core_Model_Store $store
*
* @return Bronto_Api_Contact_Row
*/
protected function _processStoreCredit(Bronto_Api_Contact_Row $brontoContact, Mage_Customer_Model_Customer $customer, Mage_Core_Model_Store $store)
{
// If Store Credit is installed
if (Mage::helper('bronto_common')->isModuleInstalled('Enterprise_CustomerBalance')) {
$_fieldName = Mage::helper('bronto_customer')->getCustomerAttributeField('store_credit', 'store', $store->getId());
/** @var Enterprise_CustomerBalance_Model_Balance $balance */
$balance = Mage::getModel('enterprise_customerbalance/balance')->setCustomerId($customer->getId())->setWebsiteId($store->getWebsiteId())->loadByCustomer();
$_attributeValue = Mage::app()->getLocale()->currency($balance->getWebsiteCurrencyCode())->toCurrency($balance->getAmount());
// Skip un-mapped or empty attributes
if ($this->_skippableProcessValue($_fieldName, $_attributeValue)) {
return $brontoContact;
}
$brontoContact->setField($_fieldName, $_attributeValue);
}
return $brontoContact;
}
示例11: filterByStore
/**
* @param $store Mage_Core_Model_Store
*/
public function filterByStore(Mage_Core_Model_Store $store)
{
$this->filterExcludeDeleted();
$this->addFieldToFilter('scope_id', $store->getWebsiteId());
}
示例12: coreStoreGroupDeleteBefore
/**
* Disallow deleting store group or store
*
* @param Mage_Core_Model_Store|Mage_Core_Model_Store_Group $model
*/
public function coreStoreGroupDeleteBefore($model)
{
if ($model->getId() && $this->_role->hasWebsiteAccess($model->getWebsiteId(), true)) {
return;
}
$this->_throwDelete();
}
示例13: _getAllProducts
/**
* Get select for all products
*
* @param $store
* @return Varien_Db_Select
*/
protected function _getAllProducts(Mage_Core_Model_Store $store)
{
if (!isset($this->_allProductsSelect[$store->getId()])) {
/** @var $eavConfig Mage_Eav_Model_Config */
$eavConfig = $this->_factory->getSingleton('eav/config');
$statusAttributeId = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'status')->getId();
$visibilityAttributeId = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'visibility')->getId();
$select = $this->_connection->select()->from(array('cp' => $this->_getTable('catalog/product')), array())->joinInner(array('cpw' => $this->_getTable('catalog/product_website')), 'cpw.product_id = cp.entity_id', array())->joinInner(array('cpsd' => $this->_getTable(array('catalog/product', 'int'))), 'cpsd.entity_id = cp.entity_id AND cpsd.store_id = 0 AND cpsd.attribute_id = ' . $statusAttributeId, array())->joinLeft(array('cpss' => $this->_getTable(array('catalog/product', 'int'))), 'cpss.entity_id = cp.entity_id AND cpss.attribute_id = cpsd.attribute_id' . ' AND cpss.store_id = ' . $store->getId(), array())->joinInner(array('cpvd' => $this->_getTable(array('catalog/product', 'int'))), 'cpvd.entity_id = cp.entity_id AND cpvd.store_id = 0' . ' AND cpvd.attribute_id = ' . $visibilityAttributeId, array())->joinLeft(array('cpvs' => $this->_getTable(array('catalog/product', 'int'))), 'cpvs.entity_id = cp.entity_id AND cpvs.attribute_id = cpvd.attribute_id ' . 'AND cpvs.store_id = ' . $store->getId(), array())->joinLeft(array('ccp' => $this->_getTable('catalog/category_product')), 'ccp.product_id = cp.entity_id', array())->where('cpw.website_id = ?', $store->getWebsiteId())->where($this->_connection->getIfNullSql('cpss.value', 'cpsd.value') . ' = ?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->where($this->_connection->getIfNullSql('cpvs.value', 'cpvd.value') . ' IN (?)', array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH))->group('cp.entity_id')->columns(array('category_id' => new Zend_Db_Expr($store->getRootCategoryId()), 'product_id' => 'cp.entity_id', 'position' => new Zend_Db_Expr($this->_connection->getCheckSql('ccp.product_id IS NOT NULL', 'ccp.position', '0')), 'is_parent' => new Zend_Db_Expr($this->_connection->getCheckSql('ccp.product_id IS NOT NULL', '0', '1')), 'store_id' => new Zend_Db_Expr($store->getId()), 'visibility' => new Zend_Db_Expr($this->_connection->getIfNullSql('cpvs.value', 'cpvd.value'))));
$this->_allProductsSelect[$store->getId()] = $select;
}
return $this->_allProductsSelect[$store->getId()];
}
示例14: _processStoreCredit
/**
* @param Bronto_Api_Contact_Row $brontoContact
* @param Mage_Customer_Model_Customer $customer
* @param Mage_Core_Model_Store $store
*
* @return Bronto_Api_Contact_Row
*/
protected function _processStoreCredit(Bronto_Api_Contact_Row $brontoContact, Mage_Customer_Model_Customer $customer, Mage_Core_Model_Store $store)
{
// If Store Credit is installed
if (Mage::helper('bronto_common')->isModuleInstalled('Enterprise_CustomerBalance')) {
$_fieldName = Mage::helper('bronto_customer')->getCustomerAttributeField('store_credit', 'store', $store->getId());
/** @var Enterprise_CustomerBalance_Model_Balance $balance */
$balance = Mage::getModel('enterprise_customerbalance/balance')->setCustomerId($customer->getId())->setWebsiteId($store->getWebsiteId())->loadByCustomer();
$_attributeValue = Mage::app()->getLocale()->currency($balance->getWebsiteCurrencyCode())->toCurrency($balance->getAmount());
// Skip un-mapped or empty attributes
if (empty($_fieldName) || '_none_' == $_fieldName || !$_attributeValue || '' == $_attributeValue) {
return $brontoContact;
}
// Store Bronto Key => Magento field label for errors
if (!array_key_exists($_fieldName, $this->_fieldMap)) {
$this->_fieldMap[$_fieldName] = 'Store Credit';
}
$brontoContact->setField($_fieldName, $_attributeValue);
}
return $brontoContact;
}
示例15: addStoreFilter
/**
* @param Mage_Core_Model_Store $store
* @return $this
*/
public function addStoreFilter(Mage_Core_Model_Store $store)
{
$this->addFieldToFilter('website_id', ['in' => [0, (int) $store->getWebsiteId()]]);
return $this;
}