如何将(重新编码)扩展从OpenCart 1.5转换为2.3

时间:2017-03-01 19:11:19

标签: opencart opencart2.x opencart-module opencart2.3

我曾经为OpenCart 1.5制作了几个扩展程序,我希望"转换"他们加入OpenCart 2.3.0.2。

我很难确定如何为2.3.0.2执行以下操作:

    echo "Free Items Disabler started.<br>";
    $sqll = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";

    $result = mysql_query($sqll)or die(mysql_error());
    $antall = mysql_num_rows($result);
    echo "Products to check: ".$antall."<br>";
 ... 
$this->session->data['success'] = 'Free Items Disabler has
 disabled ' . $products_changed . ' products with no price!';
  • 如何在页面上打印消息? Echo没有在任何地方展示。
  • 如何计算查询结果?我尝试时页面总是停止工作。

我已经尝试过查看其他2.3扩展程序来解决这个问题,但我找不到任何类似的东西。我花了两天时间试图解决这个问题。

1 个答案:

答案 0 :(得分:0)

解决方案原来是:

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) ");
$num = $query->rows;
...
$this->session->data['success'] = 'Free Items Disabler has disabled ' . $products_changed . ' products with no price!';