我們有一個名爲web_availability
的屬性代碼,向消費者發送不同形式的產品可用性消息。例如:可用性「80」應在搜索結果和/或產品詳細信息頁面上顯示「僅限於商店」。Magento自定義消息傳遞
<input type="text" class="input-text required-option" value="80" name="option[value][532][0]">
我聲明的變量爲:放置到下列Magento的price.phtml
<?php
$_shipping_messaging = $_product->getShippingMessaging(); //looks for a value of "0" or "1" to assign either Free Shipping, or Plus Shipping Messaging
$_shipping_price = $_product->getShippingPrice(); //if product is plus shipping this messages the approximate shipping price on the product
$web_avail_options = $_product->getResource()->getAttribute('web_availability')) {
foreach ($web_avail_options as $web_avail_option) {
if ($web_avail_option['value'] == $_product->getData('web_availability')) {
$web_availability = $web_avail_option['label'];
}
}
?>
每次我們設置可用性值如下自動在Magento分配選項值:
<?php
if ($shipping_messaging == 0) {
echo '+ $' . number_format($_shipping_price, 2) . " Shipping"; // displays "+ $x.xx Shipping" on the product page
} elseif ($_shipping_messaging == 1) {
echo "Free Shipping"; // displays "Free Shipping" on the product page
}
else ($web_avail_option == '70' || '80' || '90'); {
echo "In Store Only";
}
?>
運輸信息(「免運費」,或「+ $ 4.80運費)出現,因爲我期望他們,howeve無論產品的可用性如何,始終顯示「僅限於店內」信息。我嘗試過所有可能的組合==
,<
,>
,以及使用在開頭聲明的初始變量的不同部分?