Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Call Request: Buy With One Click Notification Email Template Rate Topic   - - - - -

  • keved
  • Newbie
  • Members
  • Join Date: 26-Mar 20
  • 4 posts

Posted 04 August 2020 - 02:43 AM #1

Hi Guys, we need to be able to collect Name, phone and email details using the buy with one click notification addon, currently the addon notification email only sends the details of name and phone number.
I understand that the out of the box that the popup options for phone and email were phone or email and have removed the “or” statement and added cm-required the email field so both fields are required. Works fine.

<!--div class="ty-cr-or">— {__("or")} —</div-->

    <div class="ty-control-group">

        <label for="call_data_{$id}_email" class="ty-control-group__title cm-email cm-required">{__("email")}</label>

        <input id="call_data_{$id}_email" class="ty-input-text-full" size="50" type="text" name="call_data[email]" value="{$call_data.email}" />


However, the addon does not log emails in cscart_call_request database as there is no column setup for emails. So I extended the database with the column emails and after testing works fine.
Now comes to the part that I’m stuck on. The call request: buy with one click notification email template.
The variables that are included in the template don’t include email and I don’t know how to add the query to the template, I thought I came across the answer when I added a line to the app/addons/call_requests/Tygh/Addons/CallRequests/Notifications/DataProviders/RequestAboutProductCratedDataProvider.php and was expecting this to solve the issue and adding a variable “email” to the list

$data['email'] = $this->call_request['email'];

As see below

 *                                                                          *
 *   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
 *                                                                          *
 * This  is  commercial  software,  only  users  who have purchased a valid *
 * license  and  accept  to the terms of the  License Agreement can install *
 * and use this program.                                                    *
 *                                                                          *

namespace Tygh\Addons\CallRequests\Notifications\DataProviders;

use Tygh\Exceptions\DeveloperException;
use Tygh\Notifications\DataProviders\BaseDataProvider;

class RequestAboutProductCreatedDataProvider extends BaseDataProvider
    protected $call_request = [];

    public function __construct(array $data)
        if (empty($data['call_request_data'])) {
            throw new DeveloperException('The call request must be defined.');

        $this->call_request = $data['call_request_data'];

        $data['url'] = $this->getUrl();
        $data['customer'] = $this->call_request['name'];
        $data['phone_number'] = $this->call_request['phone'];
        $data['email'] = $this->call_request['email'];
	$data['product_url'] = $this->getProductUrl();
        $data['product_name'] = $this->getProductName();


    protected function getUrl()
        if (fn_allowed_for('MULTIVENDOR')) {
            return fn_url('call_requests.manage?id=' . $this->call_request['request_id'], 'V', 'current', $this->getLanguageCode());

        return fn_url('call_requests.manage?id=' . $this->call_request['request_id'], 'A', 'current', $this->getLanguageCode());

    protected function getProductUrl()
        if (isset($this->call_request['product_id'])) {
            return fn_url('products.view?product_id=' . $this->call_request['product_id'], 'C');

        return null;

    protected function getProductName()
        if (isset($this->call_request['product_id'])) {
            return fn_get_product_name($this->call_request['product_id'], $this->getLanguageCode());

        return null;

    protected function getLanguageCode()
        $lang_code = fn_get_company_language($this->call_request['company_id']);
        if (empty($lang_code)) {
            $lang_code = CART_LANGUAGE;

        return $lang_code;

Does anybody have any ideas how I can get this working? I know that I’m close just not close enough  :? 


Need to be able to query the database for the email and add the email to the notification template.


Thanks in advance. Kev