在预店模块中检索产品,并在结帐页面后放置模块


Retrieve products in prestashop module and place module after check out page

我正在写一个模块,让我们称之为base,这将显示一个按钮后,游客已经点击购买+确认。这是总价显示的页面,感谢信息和电子邮件将被发送。

在该页上,我想添加我的模块与按钮,点击将产品详细信息发送到另一个web服务。现在我有几个问题:

  1. 我可以使用哪个钩子将该按钮放置在确认(结账后)页面上。正如你所看到的,我正在使用几个钩子,只是为了看看按钮是否出现。它只出现在left column

  2. 您认为代码的总体情况如何?getProducts()是从另一个标准模块复制过来的正确方法吗?你能给我举个例子吗?

请忽略全局。

base.php(仅重要部分)

<?php
if ( !defined( '_PS_VERSION_' ) )
  exit;
class Base extends Module
{
  public function install() {
        return parent::install() && $this->registerHook('payment') && $this->registerHook('invoice') && $this->registerHook('leftColumn');
  }
  public function uninstall() {
        parent::uninstall();
  }
  public function getContent() {
        return '<h2>'.$this->displayName.'</h2> <div>nothing to configure</div>';
  }
  public function hookPayment($params) {
        if (!$this->active)
          return;
        global $smarty;
        $smarty->assign('buttonText', $this->l('Send to my base'));
        return $this->display(__FILE__, 'base.tpl');
}

  public function ajaxCall($params) {
        if (Configuration::get('PS_CATALOG_MODE'))
          return "return;";
        return $params['cart']->getProducts(true);
  }
}

products.php

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../init.php');
include(dirname(__FILE__).'/base.php');
$cart = new Cart((int)($cookie->id_cart));
$cart->id_lang = (int)($cookie->id_lang);
$base = new Base();
var_dump( $base->hookAjaxCall(array('cookie' => $cookie, 'cart' => $cart)) );

你可以使用这个钩子:

{$HOOK_ORDER_CONFIRMATION}
{$HOOK_PAYMENT_RETURN}  

该钩子显示在订单确认中。付款确认后的第三方物流