本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute_Abstract::getStoreId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute_Abstract::getStoreId方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getStoreId怎么用?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getStoreId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute_Abstract
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute_Abstract::getStoreId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createIndexData
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$data = array();
$data['store_id'] = $attribute->getStoreId();
$data['entity_id'] = $object->getId();
$data['attribute_id'] = $attribute->getId();
$result = array();
$values = $object->getData($attribute->getAttributeCode());
if (!is_array($values)) {
return $result;
}
foreach ($values as $row) {
if (isset($row['delete']) && $row['delete']) {
continue;
}
$data['qty'] = $row['price_qty'];
$data['value'] = $row['price'];
if ($row['cust_group'] == Mage_Customer_Model_Group::CUST_GROUP_ALL) {
foreach ($this->_customerGroups as $group) {
$data['customer_group_id'] = $group->getId();
$result[] = $data;
}
} else {
$data['customer_group_id'] = $row['cust_group'];
$result[] = $data;
}
}
return $result;
}
示例2: createIndexData
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$data = array();
$data['store_id'] = $attribute->getStoreId();
$data['entity_id'] = $object->getId();
$data['attribute_id'] = $attribute->getId();
$data['value'] = $object->getData($attribute->getAttributeCode());
if ($attribute->getFrontendInput() == 'multiselect') {
$origData = $data;
$data = array();
$value = explode(',', $origData['value']);
foreach ($value as $item) {
$row = $origData;
$row['value'] = $item;
$data[] = $row;
}
}
//return $this->_spreadDataForStores($object, $attribute, $data);
return $data;
}
示例3: createIndexData
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$data = array();
$data['store_id'] = $attribute->getStoreId();
$data['entity_id'] = $object->getId();
$data['attribute_id'] = $attribute->getId();
$data['value'] = $object->getData($attribute->getAttributeCode());
if ($attribute->getAttributeCode() == 'price') {
$result = array();
foreach ($this->_customerGroups as $group) {
$object->setCustomerGroupId($group->getId());
$finalPrice = $object->getFinalPrice();
$row = $data;
$row['customer_group_id'] = $group->getId();
$row['value'] = $finalPrice;
$result[] = $row;
}
return $result;
}
return $data;
}
示例4: savePrices
/**
* Save Options prices (Depends from price save scope)
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Type_Configurable_Attribute
*/
public function savePrices($attribute)
{
$newValues = $attribute->getValues();
$oldValues = array();
$valueIndexes = array();
$select = $this->_getWriteAdapter()->select()->from($this->_priceTable)->where('product_super_attribute_id=?', $attribute->getId());
$query = $this->_getWriteAdapter()->query($select);
while ($row = $query->fetch()) {
$key = join('-', array($row['website_id'], $row['value_index']));
$oldValues[$key] = $row;
}
$delete = array();
$insert = array();
$update = array();
foreach ($newValues as $value) {
$valueIndexes[$value['value_index']] = $value['value_index'];
}
if ($this->getCatalogHelper()->isPriceGlobal()) {
foreach ($oldValues as $row) {
if (!isset($valueIndexes[$row['value_index']])) {
$delete[] = $row['value_id'];
continue;
}
}
foreach ($newValues as $value) {
$valueObject = new Varien_Object($value);
$key = join('-', array(0, $value['value_index']));
$pricingValue = $valueObject->getPricingValue();
if ($pricingValue == '' || is_null($pricingValue)) {
$pricingValue = null;
} else {
$pricingValue = Mage::app()->getLocale()->getNumber($pricingValue);
}
// update
if (isset($oldValues[$key])) {
$oldValue = $oldValues[$key];
$update[$oldValue['value_id']] = array('pricing_value' => $pricingValue, 'is_percent' => intval($valueObject->getIsPercent()));
} else {
if (!empty($value['pricing_value'])) {
$insert[] = array('product_super_attribute_id' => $attribute->getId(), 'value_index' => $valueObject->getValueIndex(), 'is_percent' => intval($valueObject->getIsPercent()), 'pricing_value' => $pricingValue, 'website_id' => 0);
}
}
}
} else {
$websiteId = Mage::app()->getStore($attribute->getStoreId())->getWebsiteId();
foreach ($oldValues as $row) {
if (!isset($valueIndexes[$row['value_index']])) {
$delete[] = $row['value_id'];
continue;
}
}
foreach ($newValues as $value) {
$valueObject = new Varien_Object($value);
$key = join('-', array($websiteId, $value['value_index']));
$pricingValue = $valueObject->getPricingValue();
if ($pricingValue == '' || is_null($pricingValue)) {
$pricingValue = null;
} else {
$pricingValue = Mage::app()->getLocale()->getNumber($pricingValue);
}
// update
if (isset($oldValues[$key])) {
$oldValue = $oldValues[$key];
if ($websiteId && $valueObject->getUseDefaultValue()) {
$delete[] = $oldValue['value_id'];
} else {
$update[$oldValue['value_id']] = array('pricing_value' => $pricingValue, 'is_percent' => intval($valueObject->getIsPercent()));
}
} else {
if ($websiteId && $valueObject->getUseDefaultValue()) {
continue;
}
$insert[] = array('product_super_attribute_id' => $attribute->getId(), 'value_index' => $valueObject->getValueIndex(), 'is_percent' => intval($valueObject->getIsPercent()), 'pricing_value' => $pricingValue, 'website_id' => $websiteId);
}
$key = join('-', array(0, $value['value_index']));
if (!isset($oldValues[$key])) {
$insert[] = array('product_super_attribute_id' => $attribute->getId(), 'value_index' => $valueObject->getValueIndex(), 'is_percent' => 0, 'pricing_value' => null, 'website_id' => 0);
}
}
}
if (!empty($delete)) {
$where = $this->_getWriteAdapter()->quoteInto('value_id IN(?)', $delete);
$this->_getWriteAdapter()->delete($this->_priceTable, $where);
}
if (!empty($update)) {
foreach ($update as $valueId => $valueData) {
$where = $this->_getWriteAdapter()->quoteInto('value_id=?', $valueId);
$this->_getWriteAdapter()->update($this->_priceTable, $valueData, $where);
}
}
if (!empty($insert)) {
foreach ($insert as $valueData) {
$this->_getWriteAdapter()->insert($this->_priceTable, $valueData);
}
//.........这里部分代码省略.........