Как включить PHP в определенном шаблоне Smarty?

Приветствую! Пожалуйста подскажите как включить обработку PHP в необходимом шаблоне (например checkout.tpl)? Если необходимо подключить SmartyBC то где именно этого необходимо сделать (найти)?

Никак, в ядре это все жестко режется. Что вам нужно сделать?

2 лайка

Необходимо внедрить вот эту форму в checkout:

    <?php
class PayService
{
    private $secretkey;
    public  $key; 
    public  $amount;
    public  $info; 
    public  $orderid;
    public  $callbackUrl;
    public  $returnUrl;
    public  $email;
    public  $phone;
    public  $status;
    public  $transactionId;

    public function __construct($key, $pass)
    {
        $this->key = $key;
        $this->secretkey = hash_hmac('sha256', $pass, $key);
    }

    function token(){
      $this->amount = sprintf('%.2f',$this->amount);
      if($this->amount !== '' && $this->key !== '' && $this->orderid !== '' && $this->callbackUrl !== ''){
        return hash_hmac('sha256', $this->key.$this->orderid.$this->amount.$this->callbackUrl, $this->secretkey);
      }
    }

    function callback(){
        return hash_hmac('sha256', $this->orderid.$this->status.$this->transactionId, $this->secretkey);
    }

    function checkOrderToken(){
        return hash_hmac('sha256', $this->key.$this->orderid, $this->secretkey);
    }

    function tokenInfo($jsn){
        return hash_hmac('sha256', $jsn, $this->secretkey);
    }
}

  $a = new PayService('778234','OkzllasvLjCvdgtDyAolVt');
  $a->amount = 3.00;
  $a->orderid = '321123'; //from merchant shop
  $a->callbackUrl = 'https://web.ru/thank_you.php';
  $a->returnUrl = 'https://web.ru';
  $a->info = 'Test Product';
  $a->email = 'test@web.ru';//optional
  $a->phone = '79877888721';//optional
  $token = $a->token();

$data = array('token'=>$token,
          'key'=>$a->key,
          'callbackUrl'=> $a->callbackUrl,
          'returnUrl'=>$a->returnUrl,
          'amount'=>$a->amount,
          'orderId'=>$a->orderid,
          'info'=>$a->info,
          'email'=>$a->email,
          'phone'=>$a->phone
          );
?>
 <form name="PayForm" action="https://site.com/web" method="post" id="PayForm">
    <input type="hidden" name="token" id="token" value="399ap9f24853e90985b941ea13816448d8dd5339a9be3cc63e6f9fd0e154a1cd">
    <input type="hidden" name="key" id="key" value="<?php echo  $a->key;?>">
    <input type="hidden" name="callbackUrl" id="callbackUrl" value="<?php echo $a->callbackUrl;?>">
    <!-- callback url where pay service sends information about status of transactions -->
    <input type="hidden" name="returnUrl" id="returnUrl" value="<?php echo $a->returnUrl;?>">
    <input type="hidden" name="amount" id="amount" value="<?php echo $a->amount;?>" required>
    <input type="hidden" name="orderId" id="orderId" value="<?php echo $a->orderid;?>">

    <input type="hidden" name="info" id="info" value="<?php echo $a->info;?>">
    
    <input type="hidden" name="email" id="email" value="<?php echo $a->email;?>">
    <input type="hidden" name="phone" id="phone" value="<?php echo $a->phone;?>">
    <input type="submit" value="Go To">
</form>

Посмотрите тут, как корректно добавить новый способ оплаты

https://www.cs-cart.ru/videos/devel/b.9.5-sposob-oplaty-5.html

1 лайк