I use multitmerch 8 on opencart 2.3.0.2 with journal 2 for my multivendor store. I recently installed the ajax best checkout extension by xtension.in. Everything seem fine on the checkout but I observed sellers are no longer notified of their product orders via emails as before only customers and admin get notification.
I believe the extension made some changes to the checkout files. I am not an expert in Opencart. Please I need help on how to restore the seller notification .
I see the following error in the log:
Undefined index: seller_text in /home/public_html/vqmod/vqcache/vq2-system_storage_modification_catalog_view_theme_journal2_template_mail_order.tpl on line 93
Thanks
Below is the xtension controller code at \catalog\controller\extension\module\xtensions\checkout\checkout.php
<?php
class ControllerExtensionModuleXtensionsCheckoutCheckout extends Controller {
public function country() {
$json = array();
$this->load->model('localisation/country');
$country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);
if ($country_info) {
$this->load->model('localisation/zone');
$json = array(
'country_id' => $country_info['country_id'],
'name' => $country_info['name'],
'iso_code_2' => $country_info['iso_code_2'],
'iso_code_3' => $country_info['iso_code_3'],
'address_format' => $country_info['address_format'],
'postcode_required' => $country_info['postcode_required'],
'zone' => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']),
'status' => $country_info['status']
);
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
public function customfield() {
$json = array();
// Customer Group
if (isset($this->request->get['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($this->request->get['customer_group_id'], $this->config->get('config_customer_group_display'))) {
$customer_group_id = $this->request->get['customer_group_id'];
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
$custom_fields = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_model_path'))->getCustomFields($customer_group_id);
foreach ($custom_fields as $custom_field) {
$json[] = array(
'custom_field_id' => $custom_field['custom_field_id'],
'required' => $custom_field['required']
);
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
}
?>
Two multimerch vqmods files (I am not sure which is applicable here)
multimerch_core.xml
<?xml version="1.0" ?>
<!DOCTYPE modification [
]>
<modification>
<id>MultiMerch Digital Multivendor Marketplace Core</id>
<author>http://multimerch.com/</author>
<file name="system/engine/loader.php">
<operation error="skip">
<search position="after">
$this->registry = $registry;
</search>
<add>
$this->registry->set('MsLoader', \MsLoader::getInstance()->setRegistry($registry));
$this->registry->set('ms_events', new \MultiMerch\Event\EventCollection());
$this->registry->set('ms_event_manager', new \MultiMerch\Event\EventManager());
$this->registry->set('MsHooks', new \MultiMerch\Core\Hook());
$this->registry->set('MsEventManager', new \MultiMerch\Core\Event\EventManager());
$this->registry->set('ms_logger', new \MultiMerch\Logger\Logger());
</add>
</operation>
</file>
<!-- For OpenCart 2.2 and 2.3 -->
<file name="system/framework.php">
<operation>
<search position="after"><![CDATA[
if ($config->has('action_pre_action')) {
]]></search>
<add><![CDATA[
$res = $registry->get('db')->query("SELECT `value` FROM " . DB_PREFIX . "setting WHERE store_id = '0' AND `key`='msconf_config_seo_url_enable'");
$pre_actions = $config->get('action_pre_action');
foreach ($pre_actions as $key => $pre_action) {
if($pre_action == 'startup/seo_url' && $res->num_rows && $res->row['value'])
$pre_actions[$key] = 'startup/multimerch_seo_url';
}
$config->set('action_pre_action', $pre_actions);
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
// Front Controller
]]></search>
<add><![CDATA[
$registry->get('MsEventManager')->setRegistry($registry);
$registry->get('MsHooks')->setRegistry($registry);
$registry->get('MsHooks')->registerDefaultHooks();
]]></add>
</operation>
</file>
<file name="system/library/template/php.php">
<operation>
<search position="after"><![CDATA[
final class PHP {
]]></search>
<add><![CDATA[
public function __get($key) {
return \MsLoader::getInstance()->getRegistry()->get($key);
}
public function __set($key, $value) {
\MsLoader::getInstance()->getRegistry()->set($key, $value);
}
]]></add>
</operation>
</file>
<file name="system/library/cart/currency.php">
<operation>
<search position="replace"><![CDATA[public function format($number, $currency, $value = '', $format = true) {]]></search>
<add><![CDATA[public function format($number, $currency = '', $value = '', $format = true) {]]></add>
</operation>
<operation>
<search position="after"><![CDATA[public function format]]></search>
<add><![CDATA[
if (!$currency)
$currency = \MsLoader::getInstance()->getRegistry()->get('config')->get('config_currency');
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[public function has]]></search>
<add><![CDATA[
if (!$currency)
$currency = \MsLoader::getInstance()->getRegistry()->get('config')->get('config_currency');
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[($currency)]]></search>
<add><![CDATA[($currency = '')]]></add>
</operation>
<operation>
<search position="before"><![CDATA[if (isset($this->currencies[$currency])) {]]></search>
<add><![CDATA[
if (!$currency)
$currency = \MsLoader::getInstance()->getRegistry()->get('config')->get('config_currency');
]]></add>
</operation>
</file>
<!-- Enable "-" in routes -->
<file name="system/engine/action.php,system/engine/loader.php,admin/controller/startup/router.php,catalog/controller/startup/router.php">
<operation error="log">
<search position="replace"><![CDATA[preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route)]]></search>
<add><![CDATA[preg_replace('/[^a-zA-Z0-9\-_\/]/', '', (string)$route)]]></add>
</operation>
</file>
<!-- IE console fix -->
<file name="catalog/view/theme/*/template/common/header.tpl">
<operation>
<search position="before"><![CDATA[
<?php foreach ($scripts as $script) { ?>
]]></search>
<add><![CDATA[
<?php if(MsLoader::getInstance()->MsHelper->isInstalled()) { ?>
<script type="text/javascript"> if (!window.console) console = {log: function() {}}; var msconf_account_pagination_limit = '<?php echo $this->config->get('msconf_account_pagination_limit'); ?>'; var config_language = <?php echo $dt_language; ?>; var msLanguageDefaults = { ms_account_product_shipping_elsewhere: "<?php echo $this->language->get('ms_account_product_shipping_elsewhere'); ?>"} </script>
<?php } ?>
]]></add>
</operation>
</file>
<!-- load common multimerch files -->
<file name="catalog/controller/common/header.php">
<operation error="log">
<search position="after"><![CDATA[
public function index() {
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$data = array_merge(MsLoader::getInstance()->getRegistry()->get('load')->language('multiseller/multiseller'), isset($data) ? $data : array());
MsLoader::getInstance()->MsHelper->addStyle('multiseller');
// note: renamed catalog
$lang = "view/javascript/multimerch/datatables/lang/" . $this->config->get('config_language') . ".lng";
$data['dt_language'] = file_exists(DIR_APPLICATION . $lang) ? "'catalog/$lang'" : "undefined";
// Add complemented common.js
$this->document->addScript('catalog/view/javascript/ms-common.js');
$data['ms_seller_created'] = MsLoader::getInstance()->MsSeller->isCustomerSeller($this->customer->getId());
}
]]></add>
</operation>
</file>
<!-- Get order status id from database -->
<file name="catalog/model/account/order.php">
<operation>
<search position="replace"><![CDATA[
$query = $this->db->query("SELECT o.order_id, o.firstname, o.lastname, os.name as status, o.date_added, o.total, o.currency_code, o.currency_value FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id) WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND o.order_status_id > '0' AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.order_id DESC LIMIT " . (int)$start . "," . (int)$limit);
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$query = $this->db->query("SELECT o.order_id, o.firstname, o.lastname, os.name as status, os.order_status_id, o.date_added, o.total, o.currency_code, o.currency_value FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id) WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND o.order_status_id > '0' AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.order_id DESC LIMIT " . (int)$start . "," . (int)$limit);
} else {
$query = $this->db->query("SELECT o.order_id, o.firstname, o.lastname, os.name as status, o.date_added, o.total, o.currency_code, o.currency_value FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id) WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND o.order_status_id > '0' AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.order_id DESC LIMIT " . (int)$start . "," . (int)$limit);
}
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
public function getOrder($order_id) {
]]></search>
<add><![CDATA[
public function getOrder($order_id, $type = NULL) {
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$order_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` WHERE order_id = '" . (int)$order_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND order_status_id > '0'");
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
if (empty($type)) {
$order_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` WHERE order_id = '" . (int)$order_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND order_status_id > '0'");
} elseif($type == 'seller') {
$order_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` AS o, `" . DB_PREFIX . "ms_order_product_data` AS m WHERE o.order_id = m.order_id AND o.order_id = " . (int)$order_id . " AND m.seller_id = " . (int)$this->customer->getId() . " AND o.order_status_id > '0'");
}
} else {
$order_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` WHERE order_id = '" . (int)$order_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND order_status_id > '0'");
}
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$query = $this->db->query("SELECT op.*, opd.* FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "ms_order_product_data opd ON (op.order_id = opd.order_id AND op.product_id = opd.product_id AND op.order_product_id = opd.order_product_id) WHERE op.order_id = '" . (int)$order_id . "'");
if(empty($query->rows)) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
}
} else {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
}
]]></add>
</operation>
</file>
<file name="catalog/controller/account/order.php">
<operation>
<search position="after"><![CDATA[
foreach ($products as $product) {
]]></search>
<add><![CDATA[
$ms_order_product_data = FALSE;
if (MsLoader::getInstance()->MsHelper->isInstalled()) {
$ms_order_product_data = $this->MsLoader->MsOrderData->getOrderData(array(
'product_id' => $product['product_id'],
'order_id' => $product['order_id'],
'order_product_id' => $product['order_product_id'],
'single' => 1
));
$this->load->language('multiseller/multiseller');
}
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
'reorder' => $reorder,
]]></search>
<add><![CDATA[
'shipping_method' => !empty($ms_order_product_data['shipping_method']) ? " <i>(" . sprintf($this->language->get('mm_account_order_shipping_via'), $ms_order_product_data['shipping_method']) . ")</i>" : '',
]]></add>
</operation>
</file>
<file name="catalog/view/theme/*/template/account/order_info.tpl">
<operation error="log">
<search position="replace"><![CDATA[
<?php echo $product['name']; ?>
]]></search>
<add><![CDATA[
<?php echo $product['name'] . " " . $product['shipping_method']; ?>
]]></add>
</operation>
</file>
<file name="catalog/controller/common/footer.php">
<operation>
<search position="after"><![CDATA[
public function index() {
]]></search>
<add><![CDATA[
$data = array_merge(MsLoader::getInstance()->getRegistry()->get('load')->language('multiseller/multiseller'), isset($data) ? $data : array());
]]></add>
</operation>
</file>
<file name="catalog/view/theme/*/template/common/footer.tpl">
<operation error="skip">
<search position="replace"><![CDATA[
<div id="powered"><?php echo $powered; ?></div>
]]></search>
<add><![CDATA[
<div id="powered"><?php echo $powered; ?><?php echo $ms_footer; ?></div>
]]></add>
</operation>
</file>
<!-- Disable the product if quantity is 0 -->
<file name="catalog/model/checkout/order.php">
<operation>
<search position="after"><![CDATA[
$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_id = '" . (int)$order_product['product_id'] . "' AND subtract = '1'");
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
if ($this->config->get('msconf_disable_product_after_quantity_depleted')) {
$res = $this->db->query("SELECT quantity FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$order_product['product_id'] . "'");
if ((int)$res->row['quantity'] <= 0) {
MsLoader::getInstance()->MsProduct->changeStatus((int)$order_product['product_id'], MsProduct::STATUS_DISABLED);
MsLoader::getInstance()->MsProduct->disapprove((int)$order_product['product_id']);
}
}
}
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
// Admin Alert Mail
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$this->MsLoader->MsMail->sendOrderMails($order_id);
}
]]></add>
</operation>
</file>
<!-- Create product return instance for seller -->
<!--<file name="catalog/controller/account/return.php">
<operation>
<search position="after" offset="1"><![CDATA[
$this->model_account_activity->addActivity('return_guest', $activity_data);
]]></search>
<add><![CDATA[
$data = $this->request->post;
$data['return_status_id'] = (int)$this->config->get('config_return_status_id');
$data['seller_id'] = MsLoader::getInstance()->MsProduct->getSellerId($data['product_id']);
$seller_return_id = MsLoader::getInstance()->MsReturn->createReturn($data);
]]></add>
</operation>
</file>-->
<!-- Hide shipping calculations from cart if MM Vendor Shipping enabled. -->
<file name="catalog/controller/extension/total/shipping.php">
<operation>
<search position="replace"><![CDATA[
if ($this->config->get('shipping_status') && $this->config->get('shipping_estimator') && $this->cart->hasShipping()) {
]]></search>
<add><![CDATA[
if ($this->config->get('shipping_status') && $this->config->get('shipping_estimator') && $this->cart->hasShipping() && (MsLoader::getInstance()->MsHelper->isInstalled() ? (int)$this->config->get('msconf_shipping_type') !== 2 : true)) {
]]></add>
</operation>
</file>
<file name="catalog/controller/checkout/confirm.php">
<operation>
<search position="replace"><![CDATA[
if (!isset($this->session->data['shipping_method'])) {
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled() && (int)$this->config->get('msconf_shipping_type') == 2) {
foreach($this->cart->getProducts() as $product) {
if (!isset($this->session->data['ms_cart_product_shipping']['fixed'][$product['product_id']]) && !isset($this->session->data['ms_cart_product_shipping']['combined'][$product['product_id']]) && !isset($this->session->data['ms_cart_product_shipping']['free'][$product['product_id']])) {
$redirect = $this->url->link('checkout/checkout', '', true);
}
}
} else if (!isset($this->session->data['shipping_method'])) {
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
unset($this->session->data['shipping_methods']);
]]></search>
<add><![CDATA[
if(isset($this->session->data['ms_cart_product_shipping']))
unset($this->session->data['ms_cart_product_shipping']);
if(isset($this->session->data['ms_coupons']))
unset($this->session->data['ms_coupons']);
]]></add>
</operation>
</file>
<file name="catalog/controller/checkout/success.php">
<operation>
<search position="after"><![CDATA[
unset($this->session->data['totals']);
]]></search>
<add><![CDATA[
if(isset($this->session->data['ms_cart_product_shipping']))
unset($this->session->data['ms_cart_product_shipping']);
if(isset($this->session->data['ms_coupons']))
unset($this->session->data['ms_coupons']);
]]></add>
</operation>
</file>
<!-- add mm mail to customer before $this->response->redirect($this->url->link('account/return/success', '', true)); -->
<file name="catalog/controller/account/return.php">
<operation>
<search position="after"><![CDATA[
public function add() {
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
if(isset($this->request->get['product_id'])) {
$this->session->data['return_product_id'] = $this->request->get['product_id'];
}
}
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
$this->response->redirect($this->url->link('account/return/success', '', true));
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
// get product seller's email
if(isset($this->session->data['return_product_id'])) {
$seller_id = MsLoader::getInstance()->MsProduct->getSellerId($this->session->data['return_product_id']);
unset($this->session->data['return_product_id']);
if($seller_id) {
$seller_email = MsLoader::getInstance()->MsSeller->getSellerEmail($seller_id);
if($seller_email) {
$this->load->language('multiseller/multiseller');
$serviceLocator = MsLoader::getInstance()->load('\MultiMerch\Module\MultiMerch')->getServiceLocator();
$mailTransport = $serviceLocator->get('MailTransport');
$mails = new \MultiMerch\Mail\Message\MessageCollection();
$MailProductReturned = $serviceLocator->get('MailProductReturned', false)
->setTo($seller_email)
->setData(array(
'product_name' => $this->request->post['product'],
'store_name' => $this->config->get('config_name')
));
$mails->add($MailProductReturned);
$mailTransport->sendMails($mails);
}
}
}
}
]]></add>
</operation>
</file>
<file name="catalog/controller/account/register.php">
<operation>
<search position="before"><![CDATA[
// Add to activity log
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$this->ms_events->add(new \MultiMerch\Event\Event(array(
'customer_id' => $this->customer->getId(),
'event_type' => \MultiMerch\Event\Event::CUSTOMER_CREATED,
'data' => array()
)));
if($this->ms_events->count()) {
$this->ms_event_manager->create($this->ms_events);
}
}
]]></add>
</operation>
</file>
<!--<file name="admin/controller/setting/setting.php">
<operation>
<search position="before"><![CDATA[
$this->session->data['success'] = $this->language->get('text_success');
]]></search>
<add><![CDATA[
if($this->request->post['config_language'] && $this->session->data['language'] !== $this->request->post['config_language']) {
$this->session->data['language'] = $this->request->post['config_language'];
}
]]></add>
</operation>
</file>-->
<file name="catalog/controller/checkout/cart.php">
<operation error="log">
<search position="before" index="1"><![CDATA[
if ($this->config->get($result['code'] . '_status')) {
]]></search>
<add><![CDATA[
if ($result['code'] === 'mm_shipping_total')
continue;
]]></add>
</operation>
</file>
</modification>
and the other vqmod file multimerch_core_transactions.xml
<?xml version="1.0" ?>
<!DOCTYPE modification [
]>
<modification>
<id>MultiMerch Core Transactions</id>
<author>http://multimerch.com/</author>
<!-- transactions for order -->
<file name="catalog/model/checkout/order.php">
<operation>
<search position="before"><![CDATA[return $order_id;]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled())
$this->MsLoader->MsTransaction->createMsOrderDataEntries($order_id);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
$this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int)$order_status_id . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'");
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled())
$this->MsLoader->MsTransaction->createMsOrderBalanceEntries($order_id, $order_status_id);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
if (!in_array($order_info['order_status_id'], array_merge($this->config->get('config_processing_status')
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$event_exists = $this->ms_event_manager->getEvents(array(
'event_type' => \MultiMerch\Event\Event::ORDER_CREATED,
'data' => json_encode(array('order_id' => (int)$order_id)),
'single' => 1
));
if(empty($event_exists)) {
$this->ms_events->add(new \MultiMerch\Event\Event(array(
'customer_id' => $this->customer->getId(),
'event_type' => \MultiMerch\Event\Event::ORDER_CREATED,
'data' => array('order_id' => (int)$order_id)
)));
}
if($this->ms_events->count()) {
$this->ms_event_manager->create($this->ms_events);
}
}
]]></add>
</operation>
</file>
<!-- Fix admin order edit -->
<file name="catalog/controller/api/order.php">
<operation>
<search position="after"><![CDATA[
$this->model_checkout_order->editOrder($order_id, $order_data);
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled())
$this->MsLoader->MsTransaction->adminUpdateMsOrderDataEntries($order_id);
]]></add>
</operation>
<operation>
<search position="after"><![CDATA[
$this->model_checkout_order->addOrderHistory($order_id,
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$transactions = $this->MsLoader->MsTransaction->createMsOrderBalanceEntries($order_id, $this->request->post['order_status_id']);
$transaction_ids = [];
foreach($transactions as $transaction_id) {
if($transaction_id) $transaction_ids[] = $transaction_id;
}
$suborders = $this->MsLoader->MsSuborder->getSuborders(array(
'order_id' => $order_id
));
$sellers_suborders_info = array();
foreach($suborders as $suborder) {
$sellers_suborders_info[] = $suborder['seller'] . ' (#' . $order_id . '-' . $suborder['suborder_id']. ')';
}
$this->load->language('multiseller/multiseller');
$json['success'] = sprintf($this->language->get('ms_order_success_suborders_modified'), $order_id, implode(', ', $sellers_suborders_info));
if(!empty($transaction_ids)) {
$json['success'] .= ' ' . sprintf($this->language->get('ms_order_success_transactions_created'), implode(', ', $transaction_ids));
}
}
]]></add>
</operation>
<operation>
<search position="replace" index="5"><![CDATA[
$json['success'] = $this->language->get('text_success');
]]></search>
<add><![CDATA[
if(!MsLoader::getInstance()->MsHelper->isInstalled()) {
$json['success'] = $this->language->get('text_success');
}
]]></add>
</operation>
</file>
<file name="admin/view/template/marketing/coupon_form.tpl">
<operation>
<search position="before"><![CDATA[
<div class="panel panel-default">
]]></search>
<add><![CDATA[
<?php if(MsLoader::getInstance()->MsHelper->isInstalled()) { ?>
<div class="alert alert-warning" role="alert">
<?php echo MsLoader::getInstance()->getRegistry()->get('language')->get('ms_fixed_coupon_warning'); ?>
</div>
<?php } ?>
]]></add>
</operation>
</file>
<file name="admin/view/template/sale/voucher_form.tpl">
<operation>
<search position="before"><![CDATA[
<div class="panel panel-default">
]]></search>
<add><![CDATA[
<?php if(MsLoader::getInstance()->MsHelper->isInstalled()) { ?>
<div class="alert alert-warning" role="alert">
<?php echo MsLoader::getInstance()->getRegistry()->get('language')->get('ms_voucher_warning'); ?>
</div>
<?php } ?>
]]></add>
</operation>
</file>
<file name="admin/view/template/sale/voucher_list.tpl">
<operation>
<search position="before"><![CDATA[
<div class="panel panel-default">
]]></search>
<add><![CDATA[
<?php if(MsLoader::getInstance()->MsHelper->isInstalled()) { ?>
<div class="alert alert-warning" role="alert">
<?php echo MsLoader::getInstance()->getRegistry()->get('language')->get('ms_voucher_warning'); ?>
</div>
<?php } ?>
]]></add>
</operation>
</file>
<file name="catalog/controller/extension/total/coupon.php">
<operation>
<search position="before"><![CDATA[
$this->response->addHeader
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
if(isset($coupon_info["type"]) AND $coupon_info["type"] == "F"){
unset($json['redirect']);
unset($this->session->data['success']);
unset($this->session->data['coupon']);
$this->load->language('multiseller/multiseller');
$json['error'] = $this->language->get('ms_error_fixed_coupon_warning');
}
}
]]></add>
</operation>
</file>
<file name="catalog/controller/extension/total/voucher.php">
<operation>
<search position="before"><![CDATA[
$this->response->addHeader
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
unset($json['redirect']);
unset($this->session->data['success']);
unset($this->session->data['voucher']);
$this->load->language('multiseller/multiseller');
$json['error'] = $this->language->get('ms_error_voucher_warning');
}
]]></add>
</operation>
</file>
<!-- MultiMerch Discount coupons -->
<file name="catalog/controller/checkout/cart.php">
<operation>
<search position="replace"><![CDATA[$result = $this->load->controller('extension/total/' . basename($file, '.php'));]]></search>
<add><![CDATA[
$ms_controller_path = 'extension/total/' . basename($file, '.php');
if(MsLoader::getInstance()->MsHelper->isInstalled() && $this->config->get('msconf_allow_seller_coupons') && (string)basename($file, '.php') === 'coupon') {
$ms_controller_path = 'multimerch/cart_coupon';
}
$result = $this->load->controller($ms_controller_path);
]]></add>
</operation>
</file>
</modification>
Looks like a conflict between multitmerch 8 and "best checkout extension by xtension". There should be something you have to add to code of xtension controller. This "something" should be in a vqmod file or multitmerch 8 (some part that add changes to standard opencart checkout). There should be added rule for xtension controller.
Cant tell you more. Please, add to you question a code of multitmerch 8 vqmod and xtension controller. And a link to a live site.
multimerch_core.xml ... This part of code must be for email sends:
<file name="catalog/model/checkout/order.php">
<operation>
<search position="before"><![CDATA[
// Admin Alert Mail
]]></search>
<add><![CDATA[
if(MsLoader::getInstance()->MsHelper->isInstalled()) {
$this->MsLoader->MsMail->sendOrderMails($order_id);
}
]]></add>
</operation>
</file>
Check carefully vqmod cache file: /home/public_html/vqmod/vqcache/vq2-catalog_model_checkout_order.php that modification is installed at this file...
This error is result of other vqmod modification... There are no code for this in vqmod mofications that you show
Undefined index: seller_text in /home/public_html/vqmod/vqcache/vq2-system_storage_modification_catalog_view_theme_journal2_template_mail_order.tpl on line 93
The following is the code at the install.xml for the xtension module:
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Xtensions-Best Checkout and Customer FrameWork</name>
<version>Module_Version_5.0_OC_V_2.3.x.x</version>
<code>xtensions_best_checkout</code>
<file path="admin/controller/customer/custom_field.php">
<operation>
<search><![CDATA['sort_order' => $result['sort_order'],]]></search>
<add position="after"><![CDATA[
'edit_custom' => $this->url->link($this->config->get('xtensions_custom_fields_path').'/edit', 'token=' . $this->session->data['token'] . '&custom_field_id=' . $result['custom_field_id'] . $url, 'SSL'),
]]></add>
</operation>
<operation>
<search><![CDATA[$data['button_edit'] = $this->language->get('button_edit');]]></search>
<add position="after"><![CDATA[
$data['button_edit_custom'] = $this->language->get('button_edit_custom');
$data['button_add_custom'] = $this->language->get('button_add_custom');
$data['add_custom'] = $this->url->link($this->config->get('xtensions_custom_fields_path').'/add', 'token=' . $this->session->data['token'] . $url, 'SSL');
]]></add>
</operation>
</file>
<file path="admin/language/*/customer/custom_field.php">
<operation>
<search><![CDATA[<?php]]></search>
<add position="after"><![CDATA[
$_['button_edit_custom'] = 'Edit using Xtensions Custom Fields';
$_['button_add_custom'] = 'Add New using Xtensions Custom Fields';
]]></add>
</operation>
</file>
<file path="admin/view/template/customer/custom_field_list.tpl">
<operation>
<search><![CDATA[<td class="text-right"><i class="fa fa-pencil"></i></td>]]></search>
<add position="replace"><![CDATA[
<td class="text-right"><i class="fa fa-pencil"></i> <?php echo $button_edit_custom; ?><i class="fa fa-pencil"></i></td>
]]></add>
</operation>
<operation>
<search><![CDATA[<div class="pull-right"><i class="fa fa-plus"></i>]]></search>
<add position="replace"><![CDATA[
<div class="pull-right"><i class="fa fa-plus"></i> <?php echo $button_add_custom; ?><i class="fa fa-plus"></i>
]]></add>
</operation>
</file>
<file path="admin/view/template/sale/order_invoice.tpl">
<operation error="skip">
<search><![CDATA[<?php echo $order['payment_address']; ?>]]></search>
<add position="after"><![CDATA[
<?php if($order['customer_fields']){ echo '<br/>'; ?>
<?php foreach ($order['customer_fields'] as $field){?>
<?php echo $field?'<br/>'.$field:''; ?>
<?php } ?>
<?php } ?>
]]></add>
</operation>
</file>
<file path="admin/view/template/sale/order_shipping.tpl">
<operation error="skip">
<search><![CDATA[<?php echo $order['telephone']; ?>]]></search>
<add position="after"><![CDATA[
<?php foreach ($order['customer_fields'] as $field){?>
<?php echo $field?'<br/>'.$field:''; ?>
<?php } ?>
]]></add>
</operation>
</file>
<file path="admin/controller/sale/order.php">
<operation error="skip">
<search><![CDATA[$data['products'] = array();]]></search>
<add position="before"><![CDATA[
//xtensions- Custom Fields
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$order_info['store_id'])){
$formatted_address = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_path'))->getFormattedAddressForOrder($order_info);
$data['payment_address'] = $formatted_address['payment_address_formatted'];
$data['shipping_address'] = $formatted_address['shipping_address_formatted'];
}
//xtensions- Custom Fields
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[$product_data = array();]]></search>
<add position="before"><![CDATA[
//xtensions- Custom Fields
$customer_fields =array();
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$order_info['store_id'])){
$customer_fields =array();
$fieldData = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_path'))->getCustomFieldByIdentifier($order_info['custom_field'],'account');
foreach($this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_path'))->getCustomFieldsAll($order_info['customer_group_id']) as $field){
if($field['location']=='account' && $field['invoice']){
if(isset($fieldData[$field['identifier']])){
$customer_fields[] = $fieldData[$field['identifier']];
}
}
}
$formatted_address = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_path'))->getFormattedAddressForOrder($order_info);
$payment_address = $formatted_address['payment_address_formatted'];
$shipping_address = $formatted_address['shipping_address_formatted'];
}
//xtensions- Custom Fields
]]></add>
</operation>
<operation error="skip">
<search><![CDATA['order_id' => $order_id,]]></search>
<add position="before"><![CDATA[
//xtensions- Custom Fields
'customer_fields' => $customer_fields,
//xtensions- Custom Fields
]]></add>
</operation>
</file>
<file path="admin/controller/startup/startup.php">
<operation>
<search><![CDATA[$this->registry->set('cart', new Cart\Cart($this->registry));]]></search>
<add position="after"><![CDATA[
$xtensions_checkout = new XtensionsCheckout($this->registry);
$this->registry->set('xtensions_checkout', $xtensions_checkout);
]]></add>
</operation>
</file>
<file path="catalog/controller/startup/startup.php">
<operation>
<search><![CDATA[$this->registry->set('cart', new Cart\Cart($this->registry));]]></search>
<add position="after"><![CDATA[
$xtensions_checkout = new XtensionsCheckout($this->registry);
$this->registry->set('xtensions_checkout', $xtensions_checkout);
]]></add>
</operation>
</file>
<file path="catalog/model/account/customer.php">
<operation>
<search><![CDATA[$address_id = $this->db->getLastId();]]></search>
<add position="after"><![CDATA[
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id')) && isset($data['noaddress']) && $data['noaddress']){
$this->db->query("DELETE FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int)$customer_id . "' AND address_id ='".$address_id. "'");
$address_id = 0;
}
]]></add>
</operation>
</file>
<file path="catalog/controller/account/address.php">
<operation>
<search><![CDATA[public function add() {]]></search>
<add position="after"><![CDATA[
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$this->response->setOutput($this->load->controller($this->config->get('xtensions_account_controller_path').'address/add', '', 'SSL'));
return '';
}
]]></add>
</operation>
<operation>
<search><![CDATA[public function edit() {]]></search>
<add position="after"><![CDATA[
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$this->response->setOutput($this->load->controller($this->config->get('xtensions_account_controller_path').'address/edit', '', 'SSL'));
return '';
}
]]></add>
</operation>
<operation>
<search><![CDATA[$data['add'] = $this->url->link('account/address/add', '', true);]]></search>
<add position="before"><![CDATA[
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$data['addresses'] = $this->load->controller($this->config->get('xtensions_account_controller_path').'address/addresses');
}
]]></add>
</operation>
</file>
<file path="catalog/controller/checkout/checkout.php">
<operation>
<search><![CDATA[$this->response->setOutput($this->load->view('checkout/checkout', $data));]]></search>
<add position="replace"><![CDATA[
// Xtensions Best Checkout
if ($this->xtensions_checkout->isActive('xtensions_best_checkout', $this->config->get('config_store_id'))) {
$data += $this->load->language($this->config->get('xtensions_language_path'));
$data['xtensions_controller_path'] = $this->config->get('xtensions_controller_path');
$data['xheader'] = $this->load->controller($data['xtensions_controller_path'].'xheader');
$data['xfooter'] = $this->load->controller($data['xtensions_controller_path'].'xfooter');
$data['xcvc'] = $this->load->controller($data['xtensions_controller_path'].'xcvc');
$modData = $this->xtensions_checkout->getXtensionsData($this->config->get('config_store_id'), 'xtensions_best_checkout');
$data['custom_js'] = isset($modData['xconfig']['design']['js']) ? html_entity_decode($modData['xconfig']['design']['js'], ENT_QUOTES, 'UTF-8') : '';
$this->response->setOutput($this->load->view($this->config->get('xtensions_view_path').'xcheckout.tpl', $data));
// Xtensions Best Checkout
} else {
$this->response->setOutput($this->load->view('checkout/checkout', $data));
}
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment.js');]]></search>
<add position="replace"><![CDATA[
if ($this->xtensions_checkout->isActive('xtensions_best_checkout', $this->config->get('config_store_id'))) {
// $this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment.js'); - Included by Xtensions
} else {
$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment.js');
}
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js');]]></search>
<add position="replace"><![CDATA[
if ($this->xtensions_checkout->isActive('xtensions_best_checkout', $this->config->get('config_store_id'))) {
// $this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js'); - Included by Xtensions
} else {
$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js');
}
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[$this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');]]></search>
<add position="replace"><![CDATA[
if ($this->xtensions_checkout->isActive('xtensions_best_checkout', $this->config->get('config_store_id'))) {
// $this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css'); - Included by Xtensions
} else {
$this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');
}
]]></add>
</operation>
</file>
<file path="catalog/controller/checkout/confirm.php">
<operation>
<search><![CDATA[$this->response->setOutput($this->load->view('checkout/confirm', $data));]]></search>
<add position="replace"><![CDATA[
// Xtensions Best Checkout
$xconfig = $this->xtensions_checkout->getXtensionsData($this->config->get('config_store_id'), 'xtensions_best_checkout');
$misc_options = $xconfig['xconfig']['options'];
if(isset($misc_options['payment']['content'][$this->session->data['payment_method']['code']][$this->config->get('config_language_id')])){
$data['before_content'] = html_entity_decode($misc_options['payment']['content'][$this->session->data['payment_method']['code']][$this->config->get('config_language_id')], ENT_QUOTES, 'UTF-8');
}else{
$data['before_content'] = '';
}
if ($this->xtensions_checkout->isActive('xtensions_best_checkout', $this->config->get('config_store_id'))) {
$this->response->setOutput($this->load->view($this->config->get('xtensions_view_path').'xconfirm.tpl', $data));
} else {
$this->response->setOutput($this->load->view('checkout/confirm', $data));
}
// Xtensions Best Checkout
]]></add>
</operation>
<operation>
<search><![CDATA[$this->session->data['order_id'] = $this->model_checkout_order->addOrder($order_data);]]></search>
<add position="replace"><![CDATA[
// Xtensions Best Checkout
$data['isBestActive'] = $this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'));
if(!isset($this->session->data['order_id']) || !$this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$this->session->data['order_id'] = $this->model_checkout_order->addOrder($order_data);
}else{
$this->model_checkout_order->editOrder($this->session->data['order_id'],$order_data);
$this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_model_path'))->editOrderXtensions($this->session->data['order_id'],$order_data);
}
// Xtensions Best Checkout
]]></add>
</operation>
</file>
<file path="catalog/model/checkout/order.php">
<operation error="skip">
<search><![CDATA['order_id' => $order_query->row['order_id'],]]></search>
<add position="after"><![CDATA[
// Xtensions Best Checkout
'customer_group_id' => $order_query->row['customer_group_id'],
// Xtensions Best Checkout
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[$data['ip'] = $order_info['ip'];]]></search>
<add position="after"><![CDATA[
// Xtensions Best Checkout
$data['customer_fields'] = array();
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$fieldData = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_model_path'))->getCustomFieldByIdentifier($order_info['custom_field'],'account');
foreach($this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_model_path'))->getCustomFields($order_info['customer_group_id']) as $field){
if($field['location']=='account' && $field['email_display']){
if(isset($fieldData[$field['identifier']])){
$data['customer_fields'][] = array('name'=>$field['name'],'value'=>$fieldData[$field['identifier']]);
}
}
}
}
// Xtensions Best Checkout
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[$data['products'] = array();]]></search>
<add position="before"><![CDATA[
// Xtensions Best Checkout
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$formatted_address = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_model_path'))->getFormattedAddressForOrder($order_info);
$data['payment_address'] = $formatted_address['payment_address_formatted'];
$data['shipping_address'] = $formatted_address['shipping_address_formatted'];
}
// Xtensions Best Checkout
]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/mail/order.tpl">
<operation>
<search><![CDATA[<b><?php echo $text_ip; ?></b> <?php echo $ip; ?><br />]]></search>
<add position="before"><![CDATA[
<?php foreach ($customer_fields as $field){?>
<?php if($field['value']){ ?>
<b><?php echo $field['name']; ?></b> <?php echo $field['value']; ?><br />
<?php } ?>
<?php } ?>
]]></add>
</operation>
</file>
<file path="catalog/controller/account/order.php">
<operation error="skip">
<search><![CDATA[$data['shipping_method'] = $order_info['shipping_method'];]]></search>
<add position="before"><![CDATA[
//xtensions- Custom Fields
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$formatted_address = $this->xtensions_checkout->getXtensionsModel($this->config->get('xtensions_custom_fields_model_path'))->getFormattedAddressForOrder($order_info);
$data['payment_address'] = $formatted_address['payment_address_formatted'];
$data['shipping_address'] = $formatted_address['shipping_address_formatted'];
}
//xtensions- Custom Fields
]]></add>
</operation>
</file>
<file path="catalog/controller/account/edit.php">
<operation>
<search><![CDATA[public function index() {]]></search>
<add position="after"><![CDATA[
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$this->response->setOutput($this->load->controller($this->config->get('xtensions_account_controller_path').'edit', '', 'SSL'));
return '';
}
]]></add>
</operation>
</file>
<file path="catalog/controller/account/register.php">
<operation>
<search><![CDATA[public function index() {]]></search>
<add position="after"><![CDATA[
if($this->xtensions_checkout->isActive('xtensions_best_checkout',$this->config->get('config_store_id'))){
$this->response->setOutput($this->load->controller($this->config->get('xtensions_account_controller_path').'register', '', 'SSL'));
return;
}
]]></add>
</operation>
</file>
</modification>
I have a code, but it does not work properly. When the quantity is 0 and Subtract Stock is specified as Yes, the option(s) disappear.
The option(s) remains only when Subtract Stock is specified as No.
Code:
In catalog/controller/product/product.php
First:
Replace: if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
OG: if ($option_value['subtract']) {
Second:
After: $option_value['name'],
Add: 'quantity' => $option_value['quantity'],
In catalog/view/theme/*/template/product/product.tpl
Replace:
<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" />
OG:
<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" <?php if ($option_value['quantity'] == 0) { ?> disabled <?php } ?> />
In catalog/controller/product/product.php
remove:
if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) { and the closing bracket } a couple lines further down.
Now,
add:
'quantity' => $option_value['quantity'],
after:
$product_option_value_data[] = array(
In product.tpl
<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" <?php if ($option_value['quantity'] == 0) { echo 'disabled'; } ?> />
Am new in OpenCart MVC, I have page called my_account.tpl. In this page am displaying customer name and tin_number.
If customers want to change their tin_number just fill the TIN Number field and click save, it will update oc_customer tabel.
I tried but data's not update.
Following view, model, and controller codes
View: my_account.tpl
<form action="<?php echo $action;?>" method="POST" enctype="multipart/form-data" class="form-horizontal">
<div class="col-md-9 col-lg-6 col-sm-12">
<?php foreach($customerData as $customer) { ?>
<div class="form-group">
<label>Name:</label>
<input type="text" style="display: none" placeholder="ID" name="id" value="<?php echo $result['tin_number'];?>">
<input type="text" name="name" value="<?php echo $customer['name']; ?>" placeholder="Name" class="form-control" disabled>
</div>
<div class="form-group">
<label>TIN Number:</label>
<input type="text" name="tin_number" value="<?php echo $customer['tin_number']; ?>" placeholder="TIN Number" class="form-control">
</div>
<?php } ?>
<div class="form-group">
<input type="submit" name="save" value="<?php echo 'Save'; ?>" class="btn btn-primary">
</div>
</div>
</form>
Controller: my_account.php
public function edit() {
/*form edit my_account*/
if(isset($_GET['tin_number']))
{
$tin_number=$_GET['tin_number'];
}
$this->load->model('account/customer');
$data['delivery_point']=$this->model_account_customer->getcustomerId($tin_number);
$data['action'] = $this->url->link('account/my_account', '', 'SSL');
if ($this->request->server['REQUEST_METHOD'] == 'POST')
{
$this->model_account_customer->editCustomerTin($this->request->post);
$this->response->redirect($this->url->link('account/home', '', 'SSL'));
echo "<script>javascript: alert('test msgbox')></script>";
}
/*form edit my_account*/
}
Model: my_account.php
public function editCustomerTin($data)
{
$query = $this->db->query("UPDATE " . DB_PREFIX . "customer set tin_number='".$data['tin_number']."' where customer_id=".$data['id']);
}
I got the answer it working in another function see below the coding
controller my_account.php
public function index() {
$this->load->language('account/account');
$this->document->setTitle($this->language->get('heading_title'));
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('Home'),
'href' => $this->url->link('common/home')
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('Previous'),
'href' => $this->url->link('common/home', '', 'SSL')
);
if (isset($this->session->data['success'])) {
$data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$data['success'] = '';
}
$data['heading_title'] = $this->language->get('heading_title');
$url = '';
$this->load->model('account/customer');
//$data['customerData']=array();
$results=$this->model_account_customer->getCustomerByTin();
foreach($results as $result)
{
$query1 = $this->db->query("SELECT concat(firstname,' ',lastname) as name,tin_number,invoice_no_overwrite FROM " . DB_PREFIX . "customer where customer_id='".$_COOKIE['customerId']."'");
$customer_name= $query1->row['name'];
$tin_number= $query1->row['tin_number'];
$invoice_no_overwrite= $query1->row['invoice_no_overwrite'];
$data['customerData'][0] = array(
'name' => $customer_name,
'invoice_no_overwrite'=> $invoice_no_overwrite,
'tin_number'=>$tin_number
);
}
//var_dump($data['CustomerData']);
/*form edit my_account*/
if ($this->request->server['REQUEST_METHOD'] == 'POST')
{
$this->model_account_customer->editCustomerTin($this->request->post);
$this->response->redirect($this->url->link('account/my_account', '', 'SSL'));
}
/*form edit my_account*/
$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/my_account.tpl')) {
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/account/my_account.tpl', $data));
} else {
$this->response->setOutput($this->load->view('default/template/account/my_account.tpl', $data));
}
}
I don't know how its happen can any one teach me...?
Im editing template for 2.0.x open cart, and found out that the Menu one the top side - shows only upto second sub category..
and i'v been looking up controller files, template files, to edit it as I want - show just one more level (or all levels..as long as I can get more deeper level of sub sub cats..) of sub categories on the navigation on the left --- for couple weeks..and could not find the way.
header.tpl
<ul>
<?php foreach ($categories as $category_1) { ?>
<li class="sub-menu"><div><?php echo $category_1['name']; ?></div>
<?php if ($category_1['children']) { ?>
<div class="mega-menu-content style-2 col-4 clearfix">
<?php foreach($category_1['children'] as $category_2) { ?>
<ul id="m2">
<li class="mega-menu-title"><div><?php echo $category_2['name']; ?></div>
<?php if ($category_2['children']) { ?>
<ul id="m3">
<?php foreach($category_2['children'] as $category_3) { ?>
<li><div><?php echo $category_3['name']; ?></div></li>
<?php } ?>
</ul>
<?php } ?>
</li>
</ul>
<?php } ?>
</div>
<?php } ?>
</li><!-- .mega-menu end -->
<?php } ?>
</ul>
controller - header.php
//below is written to enable 3rd level sub-categories
$categories_1 = $this->model_catalog_category->getCategories(0);
foreach ($categories_1 as $category_1) {
$level_2_data = array();
$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
foreach ($categories_2 as $category_2) {
$level_3_data = array();
$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);
foreach ($categories_3 as $category_3) {
$level_3_data[] = array(
'name' => $category_3['name'],
'column' => $category_3['column'] ? $category_3['column'] : 1,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}
$level_2_data[] = array(
'name' => $category_2['name'],
'children' => $level_3_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
);
}
$this->data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'column' => $category_1['column'] ? $category_1['column'] : 1,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}
// End of the written addition
can anyone help this out please?
controller file
$categories = $this->model_catalog_category->getCategories(0);
foreach ($categories as $category) {
if ($category['top']) {
// Level 2
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach ($children as $child) {
// Level 3
$children_data2 = array();
$children2 = $this->model_catalog_category->getCategories($child['category_id']);
foreach ($children2 as $child2) {
$children_data2[] = array(
'name' => $child2['name'],
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'].'_'.$child2['category_id'])
);
}
$filter_data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
);
$children_data[] = array(
'children'=>$children_data2,
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
// Level 1
$data['categories'][] = array(
'name' => $category['name'],
'children' => $children_data,
'column' => $category['column'] ? $category['column'] : 1,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
}
In view i.e tpl file
<ul class="nav navbar-nav">
<?php foreach ($categories as $category) { ?>
<?php if ($category['children']) { ?>
<li class="dropdown"><?php echo $category['name']; ?>
<div class="dropdown-menu">
<div class="dropdown-inner">
<?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
<ul class="list-unstyled">
<?php foreach ($children as $child) { ?>
<li><?php echo $child['name']; ?></li>
<?php if($child['children']) { ?>
<?php foreach($child['children'] as $child2) { ?>
<ul>
<li><?php echo $child2['name']; ?></li>
</ul>
<?php } } ?>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php echo $text_all; ?> <?php echo $category['name']; ?> </div>
</li>
<?php } else { ?>
<li><?php echo $category['name']; ?></li>
<?php } ?>
<?php } ?>
</ul>
You need to adjust some css code to look it good.
It is tested on OpenCart version 2.0.1.1.
I am using the featured module to list products to my homepage. But while the product option works fine in the product details page, it doesnt work well in the homepage(featured module). The option values for the last product is getting repeated to all the product listings. Also add to cart has some problem. Can anyone provide a proper solution to this?
Code is as follows :
controller:
$this->data['products'] = array();
$products = explode(',', $this->config->get('featured_product'));
if (empty($setting['limit'])) {
$setting['limit'] = 5;
}
$products = array_slice($products, 0, (int)$setting['limit']);
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']);
} else {
$image = false;
}
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((float)$product_info['special']) {
$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = $product_info['rating'];
} else {
$rating = false;
}
$this->data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'price' => $price,
'product_description' => $product_info['product_description'],
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
);
$this->data['options'] = array();
//print_r($this->model_catalog_product->getProductOptions($this->request->get['product_id']));
//die("");
$option=$this->model_catalog_product->getProductOptions($product_id);
//foreach ($this->model_catalog_product->getProductOptions($product_id) as $option) //{
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
$option_value_data[] = array(
'product_option_value_id' => $option_value['product_option_value_id'],
'option_value_id' => $option_value['option_value_id'],
'name' => $option_value['name'],
'image' => $this->model_tool_image->resize($option_value['image'], 50, 50),
'price' => $price,
'price_prefix' => $option_value['price_prefix']
);
}
}
$this->data['options'][] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'option_value' => $option_value_data,
'required' => $option['required']
);
//}
}
}
view:
<?php foreach ($products as $product) { ?>
<img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" />
<?php if ($options) { ?>
<div class="options" style="color: #457A33; float: left;line-height: 23px; margin-right: 20px; width:300px;">
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'select') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option" style="float:left; width:150px;">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
<br />
What's this
</div>
<?php } ?>
<?php } ?>
The options has to be assigned to the concrete product - so populated and processed before $this->data['products'][] = array(...);:
$this->data['products'] = array();
$products = explode(',', $this->config->get('featured_product'));
if (empty($setting['limit'])) {
$setting['limit'] = 5;
}
$products = array_slice($products, 0, (int)$setting['limit']);
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']);
} else {
$image = false;
}
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((float)$product_info['special']) {
$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = $product_info['rating'];
} else {
$rating = false;
}
$options = array();
foreach ($this->model_catalog_product->getProductOptions($product_id) as $option) {
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
$option_value_data[] = array(
'product_option_value_id' => $option_value['product_option_value_id'],
'option_value_id' => $option_value['option_value_id'],
'name' => $option_value['name'],
'image' => $this->model_tool_image->resize($option_value['image'], 50, 50),
'price' => $price,
'price_prefix' => $option_value['price_prefix']
);
}
}
$options[] = array(
'product_option_id' => $option['product_option_id'],
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'option_value' => $option_value_data,
'required' => $option['required']
);
}
$this->data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'price' => $price,
'product_description' => $product_info['product_description'],
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
'options' => $options,
);
}
Now You should have the options loaded in each product respectively. Just modify your template accordingly:
<?php foreach ($products as $product) { ?>
<img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" />
<?php if ($product['options']) { ?>
<div class="options" style="color: #457A33; float: left;line-height: 23px; margin-right: 20px; width:300px;">
<?php foreach ($product['options'] as $option) { ?>
<?php if ($option['type'] == 'select') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option" style="float:left; width:150px;">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
<br />
What's this
</div>
<?php } ?>
<?php } ?>