我有捆绑产品,默认情况下选中了3个复选框.我想从页面类别列表(list.phtml
)中添加捆绑产品,而不必指定选项.我怎样才能做到这一点?
我希望用这样的javascript将数字舍入为数百:
10651.89 = 10700
10649.89 = 10600
60355.03 = 60400
951479.29 = 951500
1331360.95 = 1331400
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点 ?
非常感谢.
我想在客户地址页面上更改Magento的标准地址格式.我怎样才能做到这一点?
对于那些不知道地址格式的人来说,这是我们写地址的方法.例如,法国的英文格式是这样的:
Addressee (Natural person/Organization) More detailed description of addressee (optional) Housenumber + Streetname Postal code + uppercase town Country (if other than France)
美国的地址格式是这样的:
Name of address Street number and name Name of town, State abbreviation + ZIP code (typical handwritten format)
您可以在维基百科阅读更多内容.非常感谢.
我有这张桌子:
<table>
<thead>
<tr>
<th>Quantity</th>
<th> </th>
<th>Price</th>
<th>Sum</th>
</tr></thead>
<tbody>
<tr class="sum">
<td><input class="qty" type="text" value="1" /></td>
<td>German format: </td>
<td data_price="1375.5">1.375,50 €</td>
<td></td>
</tr>
<tr class="sum">
<td><input class="qty" type="text" value="1" /></td>
<td>English format:</td>
<td data_price="1375.5">€1,375.50</td>
<td></td>
</tr>
<tr class="sum">
<td><input name="text" type="text" class="qty" value="1" /></td>
<td>French format:</td>
<td data_price="1375.5">1 375,50 €</td>
<td></td>
</tr>
<tr class="sum">
<td><input name="text2" type="text" class="qty" value="1" /></td>
<td>Italian format:</td>
<td data_price="1375.5">€1,375.50</td>
<td></td>
</tr>
<tr class="sum">
<td><input class="qty" type="text" value="1" /></td>
<td>Spanish format:</td>
<td data_price="1375.5">€ 1.375,50</td> …
Run Code Online (Sandbox Code Playgroud) 我尝试获取给定产品的购物车物品;
我试过这段代码:
$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load('2784');
$quote = Mage::getSingleton('checkout/cart')->getQuote();
$cartItems = $quote->getItemByProduct($product);
foreach ($cartItems as $item) {
echo $item->getId()."<br/>";
}
Run Code Online (Sandbox Code Playgroud)
但它没有给出任何东西.
如何修改我的代码以正确的形式使用"getItemByProduct"?
感谢帮助.
我想复制一个产品,并在一个保存动作中连续给它一个新的sku.
我怎样才能做到这一点 ??
我试过这段代码:
$sku = '123456';
$product = Mage::getModel('catalog/product')
->loadByAttribute('sku',$sku);
$newProduct = $product->duplicate();
$newProduct->setStatus(1);
$newProduct->setSku($sku.'-v2');
$newProduct->save();
Run Code Online (Sandbox Code Playgroud)
但它抛出了这个异常:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3569-1' for key 'IDX_STOCK_PRODUCT'
Run Code Online (Sandbox Code Playgroud)
感谢帮助.