本文最後更新日期:2012年3月12日 要令購物車不要累計同一商品,就要修改[system\library\cart.php]的程式碼。

因為有其他網誌教授了這程式修改碼的方法,所以我不多詳述。今次我直接提供vQmod XML Script,適用於Opencart v1.5.1.3。
$this->data['products'][] = array(
if ($image)
<p>
<!--<br />
Make sure that you have properly installed Opencart vQmod.<br />
Copy this page of script.<br />
Save as a .xml file of utf-8 encoding without BOM into the directory [vqmod/xml].<br />
Name the file as you like.<br />
--></p>
<pre contenteditable="true">
<?xml version="1.0"?>
<modification>
<id>Hide products without photos</id>
<version>1.0.0</version>
<author>Flexidigi Solution Ltd</author>
<file name="catalog/controller/module/latest.php">
<operation error="skip">
   <search position="before"><![CDATA[
   $this->data['products'][] = array(
   ]]></search>
   <add><![CDATA[if ($image) ]]></add>
</operation>
</file>
<file name="catalog/controller/module/featured.php">
<operation error="skip">
   <search position="before"><![CDATA[
   $this->data['products'][] = array(
   ]]></search>
   <add><![CDATA[if ($image) ]]></add>
</operation>
</file>
<file name="catalog/controller/module/special.php">
<operation error="skip">
   <search position="before"><![CDATA[
   $this->data['products'][] = array(
   ]]></search>
   <add><![CDATA[if ($image) ]]></add>
</operation>
</file>
</modification>
</pre>
他媽的詳盡!連南極洲都有,方便你將網店生意拓展到企鵝族群。
Country:
不過,Opencart提供的“Country”選擇欄已經過時!例如選擇欄竟然有已經解體的南斯拉夫(Yugoslavia),卻沒有近年新成立的國家,包括塞爾維亞共和國(Serbia)、黑山共和國(Montenegro)、南蘇丹(Republic of South Sudan)。
世界局勢波譎雲詭,政區隨時變改。你可以索性在國家選擇欄加一個“other area”讓客戶選擇,那就不用花心思去更新“Country”選擇欄。
修改步驟:
更新後的“Country”選擇欄有“other area”供選擇。揀選“other area”後,“Region/State”選擇欄只有“none”可選。
Country:
Country Name ISO code (2) ISO code (3) Republic of South Sudan SS SSD Montenegro ME MNE Republic of Serbia RS SRB
無叉用的人有福了!


<textarea>HTML標籤來裝載你輸入的Product attribute,而HTML會無視textarea的換行符\n,所以店面顯示的Product attribute沒有換行。
解決辦法:將\n轉為HTML換行標籤<br />;或用不會忽略\n的HTML標籤來裝載Product attribute。
以下方法適用於Opencart v1.5.1.3
foreach ($product_attribute_query->rows as $product_attribute) {
$product_attribute_data[] = array(
'attribute_id' => $product_attribute['attribute_id'],
'name' => $product_attribute['name'],
'text' => $product_attribute['text']
);
}
$product_attribute['text']更改為nl2br($product_attribute['text'])。nl2br()是PHP函數,會在\n之前插入HTML換行標籤<br /> 。
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<tr>
<td><?php echo $attribute['name']; ?></td>
<td><?php echo $attribute['text']; ?></td>
</tr>
<?php } ?>
<td><?php echo $attribute['text']; ?></td>修改為<td><pre><?php echo $attribute['text']; ?></pre></td>。<pre>會保留文本中的空格和換行符號。
.attribute tbody tr td { white-space: pre-wrap; }
white-space: pre-wrap;會保留其套用文本中的空格和換行符號。





