Post by ioannisgr » Fri Apr 27, 2018 1:56 am

Hello i use this module to auto convert guest to register customer after complete checkout.
Download From here viewtopic.php?t=168137
i use opencart 2.2.0.0 and i want to know how to make this vqmod file compatible with my new Journal2 theme.

Thanks for your help

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>Auto-Account for OpenCart 2.2.0.0</name>
	<code>FX-AutoAcct</code>
	<version>1.0</version>
	<author>Fido-X</author>
	<link>http://www.fido-x.net</link>

	<!-- Languages - for more languages, copy the following <file> blocks and change "en-gb" to your language -->
	<file path="admin/language/en-gb/setting/setting.php">
		<operation>
			<search limit="1"><![CDATA[// Entry]]></search>
			<add position="after"><![CDATA[$_['entry_auto_account']  = 'Auto Account';
$_['help_auto_account'] = 'Allow automatic creation of account from guest checkout details.';]]></add>
		</operation>
	</file>

	<file path="catalog/language/en-gb/checkout/success.php">
		<operation>
			<search limit="1"><![CDATA[// Text]]></search>
			<add position="after"><![CDATA[$_['text_account']  = '<p>Your order has been successfully processed!</p><p>An account has been created for you with the following:&ndash;<br /><span style="margin-top: 5px; margin-left: 15px;"><strong>Username:</strong> %s</span><br /><span style="margin-top: 5px; margin-left: 15px;"><strong>Password:</strong> %s</span></p><p>You can view your order history by going to the <a href="%s">My Account</a> page and by clicking on <a href="%s">History</a>.</p><p>Please direct any questions you have to the <a href="%s">store owner</a>.</p><p>Thanks for shopping with us online!</p>';]]></add>
		</operation>
	</file>

	<file path="catalog/language/en-gb/mail/order.php">
		<operation>
			<search limit="1"><![CDATA[// Text]]></search>
			<add position="after"><![CDATA[$_['text_account']  = '<p>An account has been created for you with the following:&ndash;<br /><span style="margin-top: 5px; margin-left: 15px;"><strong>Username:</strong> %s</span><br /><span style="margin-top: 5px; margin-left: 15px;"><strong>Password:</strong> %s</span></p>';
$_['text_new_account']  = 'An account has been created for you with the following:--';
$_['text_new_username'] = 'Username:';
$_['text_new_password'] = 'Password:';
]]></add>
		</operation>
	</file>
	<!-- end Languages -->

	<!-- Admin Setting -->
	<file path="admin/controller/setting/setting.php">
		<operation>
			<search limit="1"><![CDATA[$data['entry_name'] = $this->language->get('entry_name');]]></search>
			<add position="after"><![CDATA[		// Auto Account
		$data['entry_auto_account'] = $this->language->get('entry_auto_account');
		$data['help_auto_account'] = $this->language->get('help_auto_account');
		// end Auto Account
]]></add>
		</operation>

		<operation>
			<search limit="1"><![CDATA[$this->load->model('catalog/information');]]></search>
			<add position="before"><![CDATA[		// Auto Account
		if (isset($this->request->post['config_auto_account'])) {
			$data['config_auto_account'] = $this->request->post['config_auto_account'];
		} else {
			$data['config_auto_account'] = $this->config->get('config_auto_account');
		}
		// end Auto Account
]]></add>
		</operation>
	</file>

	<file path="admin/view/template/setting/setting.tpl">
		<operation>
			<search limit="1"><![CDATA[<legend><?php echo $text_checkout; ?></legend>]]></search>
			<add position="after"><![CDATA[                <!-- Auto Account -->
                <div class="form-group">
                  <label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_auto_account; ?>"><?php echo $entry_auto_account; ?></span></label>
                  <div class="col-sm-10">
                    <label class="radio-inline">
                      <?php if ($config_auto_account) { ?>
                      <input type="radio" name="config_auto_account" value="1" checked="checked" />
                      <?php echo $text_yes; ?>
                      <?php } else { ?>
                      <input type="radio" name="config_auto_account" value="1" />
                      <?php echo $text_yes; ?>
                      <?php } ?>
                    </label>
                    <label class="radio-inline">
                      <?php if (!$config_auto_account) { ?>
                      <input type="radio" name="config_auto_account" value="0" checked="checked" />
                      <?php echo $text_no; ?>
                      <?php } else { ?>
                      <input type="radio" name="config_auto_account" value="0" />
                      <?php echo $text_no; ?>
                      <?php } ?>
                    </label>
                  </div>
                </div>
                <!-- end Auto Account -->]]></add>
		</operation>
	</file>
	<!-- end Admin Setting -->

	<!-- Customer Model -->
	<file path="catalog/model/account/customer.php">
		<operation>
			<search limit="1"><![CDATA[public function getTotalCustomersByEmail($email) {]]></search>
			<add position="before"><![CDATA[	public function getCustomerIdByEmail($email) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE email = '" . $this->db->escape($email) . "'");

		if ($query->row) {
			return $query->row['customer_id'];
		} else {
			return false;
		}
	}
]]></add>
		</operation>
	</file>
	<!-- end Customer Model -->

	<!-- Order Model -->
	<file path="catalog/model/checkout/order.php">
		<operation>
			<search limit="1"><![CDATA[$data['text_footer'] = $language->get('text_new_footer');]]></search>
			<add position="after"><![CDATA[
				// Auto Account
				if (isset($this->session->data['auto_acct']) && $this->session->data['auto_acct']) {
					$data['text_account'] = sprintf($language->get('text_account'), $order_info['email'], $this->session->data['auto_acct']['password']);
				} else {
					$data['text_account'] = '';
				}
				// end Auto Account]]></add>
		</operation>

		<operation>
			<search limit="1"><![CDATA[$text .= $language->get('text_new_footer') . "\n\n";]]></search>
			<add position="before"><![CDATA[				// Auto Account
				if (isset($this->session->data['auto_acct']) && $this->session->data['auto_acct']) {
					$text .= $language->get('text_new_account') . "\n";
					$text .= $language->get('text_new_username') . ' ' . $order_info['email'] . "\n";
					$text .= $language->get('text_new_password') . ' ' . $this->session->data['auto_acct']['password'] . "\n\n";
				}
				// end Auto Account
]]></add>
		</operation>
	</file>
	<!-- end Order Model -->

	<!-- Checkout Confirm -->
	<file path="catalog/controller/checkout/confirm.php">
		<operation>
			<search limit="1"><![CDATA[$this->load->model('checkout/order');]]></search>
			<add position="before"><![CDATA[			// Auto Account
			if ($this->config->get('config_auto_account')) {
				$this->load->model('account/customer');

				if ($order_data['customer_id'] == 0) {
					if ($this->model_account_customer->getTotalCustomersByEmail($order_data['email'])) {
						$order_data['customer_id'] = $this->model_account_customer->getCustomerIdByEmail($order_data['email']);

						if (isset($this->session->data['auto_acct'])) {
							unset($this->session->data['auto_acct']);
						}
					} else {
						$customer_data = array();

						$password = substr(md5(rand()), 0, 12);

						$customer_data['customer_group_id'] = $order_data['customer_group_id'];
						$customer_data['firstname'] = $order_data['firstname'];
						$customer_data['lastname'] = $order_data['lastname'];
						$customer_data['email'] = $order_data['email'];
						$customer_data['telephone'] = $order_data['telephone'];
						$customer_data['fax'] = $order_data['fax'];
						$customer_data['custom_field'] = $order_data['custom_field'];
						$customer_data['password'] = $password;
						$customer_data['company'] = $order_data['payment_company'];
						$customer_data['address_1'] = $order_data['payment_address_1'];
						$customer_data['address_2'] = $order_data['payment_address_2'];
						$customer_data['city'] = $order_data['payment_city'];
						$customer_data['postcode'] = $order_data['payment_postcode'];
						$customer_data['country_id'] = $order_data['payment_country_id'];
						$customer_data['zone_id'] = $order_data['payment_zone_id'];

						$order_data['customer_id'] = $this->model_account_customer->addCustomer($customer_data);

						$this->session->data['auto_acct']['customer_id'] = $order_data['customer_id'];
						$this->session->data['auto_acct']['password'] = $password;
					}
				}
			}
			// end Auto Account
]]></add>
		</operation>
	</file>
	<!-- end Checkout Confirm -->

	<!-- Checkout Success -->
	<file path="catalog/controller/checkout/success.php">
		<operation>
			<search limit="1"><![CDATA[$data['text_message'] = sprintf($this->language->get('text_guest'), $this->url->link('information/contact'));]]></search>
			<add position="replace"><![CDATA[// Auto Account
			if (isset($this->session->data['auto_acct']) && $this->session->data['auto_acct']) {
				$this->load->model('account/customer');

				$customer = $this->model_account_customer->getCustomer($this->session->data['auto_acct']['customer_id']);
				$password = $this->session->data['auto_acct']['password'];

				unset($this->session->data['auto_acct']);

				$data['text_message'] = sprintf($this->language->get('text_account'), $customer['email'], $password, $this->url->link('account/account', '', true), $this->url->link('account/order', '', true), $this->url->link('account/download', '', true), $this->url->link('information/contact'));
			} else {
				$data['text_message'] = sprintf($this->language->get('text_guest'), $this->url->link('information/contact'));
			}
			// end Auto Account]]></add>
		</operation>
	</file>
	<!-- end Checkout Success -->

	<!-- Order eMail -->
	<file path="catalog/view/theme/*/template/mail/order.tpl">
		<operation>
			<search limit="1"><![CDATA[<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_footer; ?></p>]]></search>
			<add position="before"><![CDATA[  <?php if ($text_account) { ?>
  <div style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_account; ?></div>
  <?php } ?>]]></add>
		</operation>
	</file>
	<!-- end Order eMail -->
</modification>

https://mamababy.online


User avatar
Newbie

Posts

Joined
Thu May 31, 2012 9:58 pm


Post by thekrotek » Fri Apr 27, 2018 2:35 am

Contact extension developer on the matter.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by xxvirusxx » Fri Apr 27, 2018 3:10 am

Should work with journal. I don`t see any changes in Default template files.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by ioannisgr » Fri Apr 27, 2018 3:26 am

Possibly the problem is in journal quickcheckout

https://mamababy.online


User avatar
Newbie

Posts

Joined
Thu May 31, 2012 9:58 pm

Who is online

Users browsing this forum: No registered users and 39 guests