I'm using multi-store on my Opencart 2.2 with 4 stores on production.
I'm using various vQmod extensions but i need some of these must to work on just one of the 4 stores, is this possible and how? I'm talking about vQmod extensions with just one file in vQmod folder not full Modules i can assign to different stores with Layouts.
Thanx in advance
I don't think there's any extension that is going to do this for you, because vQmod files are just modifications to core files. You'd need the author of each of those vQmod files to give you the right edits to only active for a single store, or hire someone to do those edits for you.
If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.
If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.
Thank you Johnathan, i was asking if it's technically possible to active a vQmod extension for a single store or i have to convert into a module and assign to Layout.Johnathan wrote:You'd need the author of each of those vQmod files to give you the right edits to only active for a single store, or hire someone to do those edits for you.
As Johnathan says, its not easily done as the file structure of vqmod is common to all multistores. And there so many different types of changes that vqmod can make.
However if you want to change indiviual mods, this is an approach you might take;
A very simple example, in the controller section of the appropriate mod to differentiate the different action for each store, include something like;
Then in the tpl you would put something like
However if you want to change indiviual mods, this is an approach you might take;
A very simple example, in the controller section of the appropriate mod to differentiate the different action for each store, include something like;
Code: Select all
$url = $_SERVER['SERVER_NAME'];
switch($url)
{
case 'www.mystore1.com':
//PERFORM TASK e.g.
$showmod = TRUE;
$showmsg = "showmod";
break;
case 'www.mystore2.com':
//PERFORM ANOTHER TASK OR DO NOTHING
$showmod = FALSE;
break;
}
Code: Select all
<?php
if($showmod) {
echo $modmsg;
}
?>
As i wrote i don't have complete modules with tpl, lang etc... but various single vQmod files, each one do his customization, like this:
I was hoping i could assign this extension to just 1 of the 4 stores with a php command like
Can you help me on this?
Code: Select all
<modification>
<id><![CDATA[Customizzazione conferma ordine]]></id>
<version><![CDATA[1.0.0]]></version>
<vqmver><![CDATA[2.3.0]]></vqmver>
<author><![CDATA[Yes]]></author>
<file name="catalog/controller/checkout/confirm.php">
<operation info="Spedizione prevista">
<search position="before"><![CDATA[
class ControllerCheckoutConfirm extends Controller {
]]></search>
<add><![CDATA[
require_once('yes/assets/function.consegna.php');
]]></add>
</operation>
<operation info="Spedizione prevista">
<search position="before"><![CDATA[
$this->data['products'] = array();
]]></search>
<add><![CDATA[
$this->data['text_spedizione_prevista'] = '';
$arrProdotti = array();
if ( $this->cart->hasProducts() )
{
$sp_products = $this->cart->getProducts();
foreach ( $sp_products as $sp_product )
{
$arrProdotti[ $sp_product['model'] ][ 'name' ] = $sp_product['name'];
foreach ($sp_product['option'] as $sp_option)
{
$arrProdotti[ $sp_product['model'] ][ 'option_name' ] = $sp_option['name'];
$arrProdotti[ $sp_product['model'] ][ 'option_value' ] = $sp_option['option_value'];
$arrProdotti[ $sp_product['model'] ][ 'option_value_id' ] = $sp_option['option_value_id'];
$arrProdotti[ $sp_product['model'] ][ 'option_id' ] = $sp_option['option_id'];
}
}
$this->data['text_spedizione_prevista'] = getSpedizionePrevista( $arrProdotti );
}
]]></add>
</operation>
</file>
<file name="catalog/view/theme/*/template/checkout/confirm.tpl">
<operation info="Aggiungi data di spedizione">
<search position="before"><![CDATA[
<div class="payment"><?php echo $payment; ?></div>
]]></search>
<add><![CDATA[
<div class="data_spedizione">
<h2>Spedizione prevista</h2>
<?php echo $text_spedizione_prevista; ?>
<br><br>
</div>
<script>
$(function()
{
if ( $("input[name='shipping_method']:checked").val() == 'free.free' )
{
$('#text_spedizione_express').hide();
$('#text_spedizione_standard').show();
}
else
{
$('#text_spedizione_standard').hide();
$('#text_spedizione_express').show();
}
});
</script>
]]></add>
</operation>
</file>
</modification>
Code: Select all
if($store_id)
Can you help me on this?
This mod obviously has other files with it and you would probably need to edit them aswell.
You could try to put the conditional statements around some of the code above like my example but its not just what gets displayed via the tpl file, there may be some other functionality that integrates elsewhere.
For example, this mod could have its own table(s) in the database that links to the orders. So then it may expect there to be an entry for each order and cause problems when there is not.
Or it may have some admin-side functionality that will always be accessed from the default store so the different store logic would not apply. There are too many scenarios to list.
Its may get complex very quickly.
So in this instance, for your example I would look for an established flexible shipping mod that already exists with multistore functionality or ask the mod author to make it multistore compatible. A multistore flexible shipping mod was one of the first mods I sought out for my own multistore, and even though I could have modded it myself using the existing shipping modules with conditional code for each multistore, it was a better investment for me to buy an existing mod and put my time to better use.
If it were a self-contained vqmod with no external files then it would be more feasible to do it like my example.
You could try to put the conditional statements around some of the code above like my example but its not just what gets displayed via the tpl file, there may be some other functionality that integrates elsewhere.
For example, this mod could have its own table(s) in the database that links to the orders. So then it may expect there to be an entry for each order and cause problems when there is not.
Or it may have some admin-side functionality that will always be accessed from the default store so the different store logic would not apply. There are too many scenarios to list.
Its may get complex very quickly.
So in this instance, for your example I would look for an established flexible shipping mod that already exists with multistore functionality or ask the mod author to make it multistore compatible. A multistore flexible shipping mod was one of the first mods I sought out for my own multistore, and even though I could have modded it myself using the existing shipping modules with conditional code for each multistore, it was a better investment for me to buy an existing mod and put my time to better use.
If it were a self-contained vqmod with no external files then it would be more feasible to do it like my example.
Every vQmod file i have paid to developer do a specific work, for my very personal store needs, so i cannot find on marketplace. I was only asking if a single file vQmod extension can be set with some php code to work with just 1 of 4 store in a multi-store enviroment.
In the past, when i was working with 1.5 version, i remember i installed various vQmod extension working on default store only NOT on other stores i had with multi-store, so i think there is a solution for my reverse need.
In the past, when i was working with 1.5 version, i remember i installed various vQmod extension working on default store only NOT on other stores i had with multi-store, so i think there is a solution for my reverse need.
Okay, then you could approach changing vqmod.php to use dynamically named paths (perhaps prefixed with the store url) for each of the xml, and caches etc. It currently uses fixed paths for all of these and unfortunately, it would not be a quick patch to change this although it potentially could be done.
You would still have the issue whereby the admin for all multistore reside in the default store, so you might still get problems with that but a well written mod should not break in this circumstance.
So sorry its not a simple resolve for you, I think you may have to pay a developer to do this.
As for previous mods in 1.5 working in only default store, that was a long time ago and mods could have been written in a non-multistore way or even deliberately restricted to default so that would be explained.
You would still have the issue whereby the admin for all multistore reside in the default store, so you might still get problems with that but a well written mod should not break in this circumstance.
So sorry its not a simple resolve for you, I think you may have to pay a developer to do this.
As for previous mods in 1.5 working in only default store, that was a long time ago and mods could have been written in a non-multistore way or even deliberately restricted to default so that would be explained.
I tried to send you a PM but not sure if its working
If you visit https://www.sculptex.co.uk/ and raise a ticket, I will propose a solution for you.
If you visit https://www.sculptex.co.uk/ and raise a ticket, I will propose a solution for you.
You could alter all your mods with that, its a briefer version of the example I gave using the $_SERVER['SERVER_NAME'] variable but using store Id instead. My solution to your problem is to have vqmod instance work independently for each url, no code amendments required. Just decide which vqmods to upload for each store. Let me know if you are interested.
Who is online
Users browsing this forum: Google [Bot] and 207 guests