Call Request: Buy With One Click Notification Email Template

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.


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

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();

    parent::__construct($data);
}

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