さまざまな形式の商品在庫状況を顧客に伝えるために呼び出される属性コードがありますweb_availability
。例: 在庫状況「80」は、検索結果や商品詳細ページで「店舗のみ」というメッセージを表示する必要があります。設定した各可用性値には、次のように magento のオプション値が自動的に割り当てられます。
<input type="text" class="input-text required-option" value="80" name="option[value][532][0]">
変数を次のように宣言しました。
<?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 の price.phtml に配置しました。
<?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 ドルの送料)」は期待どおりに表示されますが、製品の入手可能性に関係なく、常に「ストアのみ」のメッセージが表示さ ==
れます<
。>
最初に宣言した初期変数のさまざまな部分を使用するだけでなく、