更改后不更新Magento简单产品价格
我正在使用Magento v1.8和以下代码来提高一个简单产品的价格更改后不更新Magento简单产品价格,magento,Magento,我正在使用Magento v1.8和以下代码来提高一个简单产品的价格 $prodId = 27953; $product = Mage::getModel('catalog/product')->load($prodId); $price = $product->getPrice(); 价格很好,但是当我在Magento管理中更新产品的价格时,更新后的价格值在上面的代码中不会通过。返回旧价格。 我尝试过用shell命令清除Magento缓存并重新索引所有内容 php indexe
$prodId = 27953;
$product = Mage::getModel('catalog/product')->load($prodId);
$price = $product->getPrice();
价格很好,但是当我在Magento管理中更新产品的价格时,更新后的价格值在上面的代码中不会通过。返回旧价格。我尝试过用shell命令清除Magento缓存并重新索引所有内容
php indexer.php --reindexall
当我使用var_dump($product)时,我可以看到新的价格(75英镑)在受保护的“_defaultValues”数组中
但旧的价格(200英镑)在受保护的“U数据”阵列中
有人能告诉我为什么价格没有更新吗
> object(Mage_Catalog_Model_Product)[54]
> protected '_defaultValues' =>
> array (size=28)
> 'name' => string 'Artist Edition - Guy Archard' (length=28)
> 'meta_title' => null
> 'meta_description' => null
> 'image' => string 'no_selection' (length=12)
> 'small_image' => string 'no_selection' (length=12)
> 'thumbnail' => string 'no_selection' (length=12)
> 'url_key' => string 'artist-edition-guy-archard' (length=26)
> 'url_path' => string 'artist-edition-guy-archard.html' (length=31)
> 'page_layout' => null
> 'options_container' => string 'container1' (length=10)
> 'msrp_enabled' => string '2' (length=1)
> 'msrp_display_actual_price_type' => string '4' (length=1)
> 'price' => string '75.0000' (length=7)
> 'special_price' => null
> 'msrp' => null
> 'status' => string '1' (length=1)
> 'visibility' => string '4' (length=1)
> 'tax_class_id' => string '0' (length=1)
> 'description' => null
> 'short_description' => null
> 'meta_keyword' => null
> 'custom_layout_update' => null
> 'special_from_date' => null
> 'special_to_date' => null
> 'news_from_date' => null
> 'news_to_date' => null
> 'custom_design_from' => null
> 'custom_design_to' => null
> protected '_data' =>
> array (size=62)
> 'entity_id' => string '27953' (length=5)
> 'entity_type_id' => string '4' (length=1)
> 'attribute_set_id' => string '25' (length=2)
> 'type_id' => string 'simple' (length=6)
> 'sku' => string 'MF-ARTIST-GUY-ARCHARD' (length=21)
> 'has_options' => string '1' (length=1)
> 'required_options' => string '0' (length=1)
> 'created_at' => string '2016-08-08 17:33:06' (length=19)
> 'updated_at' => string '2016-08-08 18:35:40' (length=19)
> 'absolute_price' => string '0' (length=1)
> 'absolute_weight' => string '0' (length=1)
> 'sku_policy' => string '0' (length=1)
> 'name' => string 'Artist Edition - Guy Archard' (length=28)
> 'meta_title' => string 'Guy Archard' (length=11)
> 'meta_description' => string 'Norway' (length=6)
> 'image' => string '/M/F/MF-ARTIST-GUY-ARCHARD_19.jpg' (length=33)
> 'small_image' => string '/M/F/MF-ARTIST-GUY-ARCHARD_19.jpg' (length=33)
> 'thumbnail' => string '/M/F/MF-ARTIST-GUY-ARCHARD_19.jpg' (length=33)
> 'url_key' => string 'artist-edition-guy-archard' (length=26)
> 'url_path' => string 'artist-edition-guy-archard.html' (length=31)
> 'custom_design' => null
> 'page_layout' => null
> 'options_container' => string 'container2' (length=10)
> 'country_of_manufacture' => null
> 'msrp_enabled' => string '2' (length=1)
> 'msrp_display_actual_price_type' => string '4' (length=1)
> 'gift_message_available' => string '0' (length=1)
> 'price' => string '200.0000' (length=8)
> 'special_price' => null
> 'weight' => null
> 'msrp' => null
> 'status' => string '1' (length=1)
> 'is_recurring' => string '0' (length=1)
> 'visibility' => string '4' (length=1)
> 'enable_googlecheckout' => string '1' (length=1)
> 'tax_class_id' => string '0' (length=1)
> 'makeframe_mkyours_shape' => string '1730' (length=4)
> 'makeframe_mkyours_mldstyle' => string '1865' (length=4)
> 'makeframe_mkyours_glazing' => string '1729' (length=4)
> 'makeframe_mkyours_printchoice' => string '1804' (length=4)
> 'makeframe_mkyours_mldcolour' => string '1812' (length=4)
> 'description' => null
> 'short_description' => null
> 'meta_keyword' => null
> 'custom_layout_update' => null
> 'special_from_date' => null
> 'special_to_date' => null
> 'news_from_date' => null
> 'news_to_date' => null
> 'custom_design_from' => null
> 'custom_design_to' => null
> 'image_label' => null
> 'small_image_label' => null
> 'thumbnail_label' => null
> 'group_price' =>
> array (size=0)
> empty
> 'group_price_changed' => int 0
> 'media_gallery' =>
> array (size=2)
> 'images' =>
> array (size=2)
> ...
> 'values' =>
> array (size=0)
> ...
> 'tier_price' =>
> array (size=0)
> empty
> 'tier_price_changed' => int 0
> 'stock_item' =>
> object(Mage_CatalogInventory_Model_Stock_Item)[296]
> private '_minSaleQtyCache' =>
> array (size=0)
> ...
> protected '_qtyIncrements' => null
> protected '_eventPrefix' => string 'cataloginventory_stock_item' (length=27)
> protected '_eventObject' => string 'item' (length=4)
> protected '_productInstance' =>
> &object(Mage_Catalog_Model_Product)[54]
> protected '_customerGroupId' => null
> protected '_processIndexEvents' => boolean true
> protected '_resourceName' => string 'cataloginventory/stock_item' (length=27)
> protected '_resource' => null
> protected '_resourceCollectionName' => string 'cataloginventory/stock_item_collection' (length=38)
> protected '_cacheTag' => boolean false
> protected '_dataSaveAllowed' => boolean true
> protected '_isObjectNew' => null
> protected '_data' =>
> array (size=33)
> ...
> protected '_hasDataChanges' => boolean true
> protected '_origData' =>
> array (size=28)
> ...
> protected '_idFieldName' => string 'item_id' (length=7)
> protected '_isDeleted' => boolean false
> protected '_oldFieldsMap' =>
> array (size=2)
> ...
> protected '_syncFieldsMap' =>
> array (size=4)
> ...
> 'is_in_stock' => string '1' (length=1)
> 'is_salable' => string '1' (length=1)
Magento产品价格范围在网站级别。从你所说的,我认为你已经把新的价格放在默认的商店级别,而不是放在网站级别。所以在网站层面上,你仍然得到了旧的价格。这就是为什么你仍然看到老价格的产品 要解决此问题,您必须将网站级别的价格更改为新价格,或者在网站级别选择“使用默认值”以从默认商店获取新价格。您可以通过在“选择商店视图”下拉列表中更改您的网站来更改网站级别的价格
注意:在改变价格后,一定要记得运行reindexer落入同样的陷阱,thanx