Page 1 of 2
module control for multistore
Posted: Sat Mar 12, 2011 8:33 am
by gerigo
I have a store running with two store fronts (
http://www.alpen-markt.at).
Now i want to choose if a module shows up or not.
(for example the newsletter module should show up in store1 but NOT in store2)
Ist there any solutions how to do that without core hacking?
Re: module control for multistore
Posted: Sat Mar 12, 2011 2:25 pm
by Xsecrets
no
Re: module control for multistore
Posted: Sun Mar 13, 2011 12:26 am
by gerigo
Xsecrets wrote:no
"no" is a nogo - This is a essential function for a multishop.
I'm sure there is a ready solution out there, the question is if anybody who did this wants to give this back to the community!!!
Re: module control for multistore
Posted: Sun Mar 13, 2011 2:44 am
by gerigo
So I found out the almost too easy solution!!!
Just copy and paste the original module .tpl files in your template/modules directories, change and relax!!!
Quick and easy!
Re: module control for multistore
Posted: Thu Apr 14, 2011 8:24 pm
by Ljubo
sorry for being ignorant, but could you explain it a little bit more in details?
this would be very useful for me.
thanks!
Re: module control for multistore
Posted: Thu Apr 14, 2011 8:53 pm
by Xsecrets
well that might solve your position problems, but it's not going to give you different settings per store.
Re: module control for multistore
Posted: Thu Apr 14, 2011 8:59 pm
by gerigo
No problem, I just don't know how to start... and what you are supposing to do.
I used this for creating
http://www.kite4ever.com/index.php? which is the main store and
http://mutinykites.at/?shop which is only a new store front.
So if you have two different templates for different store fronts it works like this.
In every template you can make module overrides by simply copying the original module template files to catalog/view/theme/YOURTHEME1/template/Module/yourmodule.tpl (yourmodule.tpl can be one of the sidebar modules like newsletter, cart, information, eg.)
In theese files you can style or modify the modules, or simply uncomment or delete the code for not showing up the module in this template.
Hope this helped
Re: module control for multistore
Posted: Thu Apr 14, 2011 9:01 pm
by Ljubo
it is not the place to ask, but a quick reply needed...
customers in multistore feature of opencart;
registered customer of one store is allowed to login to other store of multistore feature as well?
although he is actually not registered at that second one?
edit> thanks for quick reply to previous question.
Re: module control for multistore
Posted: Thu Apr 14, 2011 9:10 pm
by Xsecrets
Ljubo wrote:it is not the place to ask, but a quick reply needed...
customers in multistore feature of opencart;
registered customer of one store is allowed to login to other store of multistore feature as well?
although he is actually not registered at that second one?
edit> thanks for quick reply to previous question.
quick reply.
Yes.
Re: module control for multistore
Posted: Thu Apr 14, 2011 9:12 pm
by Ljubo
gerigo wrote:
In every template you can make module overrides by simply copying the original module template files to catalog/view/theme/YOURTHEME1/template/Module/yourmodule.tpl (yourmodule.tpl can be one of the sidebar modules like newsletter, cart, information, eg.)
In theese files you can style or modify the modules, or simply uncomment or delete the code for not showing up the module in this template.
In other words, you are saying that for different template / store, I could use any module I want, only to rename the .tpl file so it has the same name like completely different module in the primary template?
Re: module control for multistore
Posted: Thu Apr 14, 2011 9:35 pm
by Ljubo
Xsecrets wrote:Yes.
even quicker question:
can it be prevented somehow?
Re: module control for multistore
Posted: Thu Apr 14, 2011 10:01 pm
by gerigo
I guess youre right concerning the registered customers login. I asked my programmer, this feature is complicated to work with the database and all other modlules and components. Maybe modifications of the corefiles are needed.
Have a look if there's a login module to buy, otherwise we can do it for you for 500-1000 Euros.
Re: module control for multistore
Posted: Thu Apr 14, 2011 10:06 pm
by gerigo
You can only change the style or appearance of the installed modules (and enabled in backend)
Re: module control for multistore
Posted: Thu Apr 14, 2011 10:15 pm
by fido-x
gerigo wrote:I guess youre right concerning the registered customers login. I asked my programmer, this feature is complicated to work with the database and all other modlules and components. Maybe modifications of the corefiles are needed.
Have a look if there's a login module to buy, otherwise we can do it for you for 500-1000 Euros.
Expensive, especially when the answer is freely available on the forum
here
Re: module control for multistore
Posted: Thu Apr 14, 2011 10:37 pm
by gerigo
You can try the free mod. (Please give me a feedback if it worked)
As i flew over it seems that your problem still isn't solved...
Re: module control for multistore
Posted: Fri Apr 15, 2011 2:21 am
by Ljubo
I have tried this modifications and feedback follows in that topic.
thank you all for your comments.
Re: module control for multistore
Posted: Fri Apr 15, 2011 4:51 pm
by fido-x
The information module is already "multi-store" compatible, as the entries displayed are based on the store id. The main issue is with product modules (latest, featured, specials, bestsellers) and the category module, which still display even if empty.
The "product" modules can be "multi-stored" very easily by wrapping the contents of the template file inside an "if" statement. Insert:
as your first line, before:
then, at the very end of the file after the last "</div>", add:
to close the "if" statement.
If there are no products, the module will not display.
For the category module, change the above "if" to:
Don't forget to add:
at the end.
If there are no categories, the category module will not display.
Re: module control for multistore
Posted: Fri Apr 15, 2011 5:25 pm
by Ljubo
thank you for sharing this.
I think it is also important to be able to show / not show other modules as well.
I suppose the similar changes would be enough, am I right?
stupid example, I want for a custom module, lets say a calender, to be showed in store1 but not showed in store2.
I mean to add somewhere in the begining the line like:
<?php if ($modulename) { ?>
and, at ending to close it with:
<?php } ?>
Would that be enough?
Re: module control for multistore
Posted: Fri Apr 15, 2011 5:55 pm
by fido-x
Ljubo wrote:thank you for sharing this.
No worries.
I mean to add somewhere in the begining the line like:
<?php if ($modulename) { ?>
and, at ending to close it with:
<?php } ?>
Would that be enough?
No. As far as the "product" modules and the category module are concerned, all the "if" does is check to see if there is any content for the module to display, and "hides" the module if there isn't any, rather than show an empty module.
For example, to hide the shopping cart module when there is nothing in the shopping cart, you could use:
Code: Select all
<?php if ($this->cart->hasProducts()) { ?>
... cart code ...
<?php } ?>
then, the shopping cart will only display if there is something in it.
Using something like:
Code: Select all
<?php if ($modulename) { ?>
... module code ...
<?php } ?>
will only check if the module exists, not whether there is actually anything in it, and will not prevent the display of an "empty" module.
Re: module control for multistore
Posted: Fri Apr 22, 2011 1:09 am
by Ljubo
gerigo wrote:You can only change the style or appearance of the installed modules (and enabled in backend)
Ok, I have just tested it.
I have SimpleHTML module installed and have enabled it to both stores, 1 and 2.
- for the store 1, I use this module-space for displaying the day, date, and clock (found a java script for that, you can paste the code into HTML box of the backend and it works)
- for the store 2, I use this module-space for things that could be seen only to logged in customers of that second store. So, I have found the way to enter the code to display some warning notice to the unregistered customers and to display its real content once the user logs in.
And that is perfect!
But, I had to have some article look, as the Information module has, so, that when a registered customer clicks on an item in the module, that link to get him to another article page displayed like in information module.
So, I created and installed a copy of Information module but now the module displays for both stores with the same name (remember, with SimpleHTML module, you could name the same module differently for two stores).
Finaly, I got an idea to try to delete all the contents of the .tpl file of that copy of Information module, while it is still enabled in the backend.
The result is excellent, module is active but not showing, just the way I need it.
I will now put the contents like articles in that new module, to copy the exact links, and just paste them into SimpleHTML Module, so that it all works like I need.
