Post by gerigo » Fri Apr 22, 2011 2:18 am

Great Information!
Could you paste the code or the source of the script which checks if a user is registered or not.
Maybe i need this in future or someone else is happy to find this...

Newbie

Posts

Joined
Sat Mar 12, 2011 8:19 am

Post by Ljubo » Sat Apr 23, 2011 9:53 pm

No problem and sorry for little delay.
Here is the full code of a side module template (.tpl file for a module that displays on left or right side of the webstore).

Code: Select all

<div class="box">
  <div class="top">
	<?php
	  if($title) { ?>	
		<img src="catalog/view/theme/default/image/brands.png" alt="" /><?php echo $title; ?>
	<?php
	} ?>
  </div>
  <div class="middle" style="text-align: left;"><div id="category">
    <?php if (!$logged) { ?>
    <strong><font color="#FF0000">Here goes some text to be shown to the unregistered visitors.</strong></font>
    <?php } else { ?>
    <?php echo $code; ?>
    <?php } ?> 
  </div>
  </div>
  <div class="bottom">&nbsp;</div>
</div>
What you actually need from here for the purpose of checking if the customer is loged in or not, is few lines in the middle:
1.

Code: Select all

<?php if (!$logged) { ?>
- this line checks if the visitor is loged in or not
2.

Code: Select all

<strong><font color="#FF0000">Here goes some text to be shown to the unregistered visitors.</strong></font>
- this is example message to be shown to not registered visitors and nothing more.
3.

Code: Select all

<?php } else { ?>
- is the else code, i.e. if the visitor is logged in, that the rest of the code is valid.
4.

Code: Select all

<?php echo $code; ?>
- this is that, so called, the rest of the code, this line is by default in all side modules.
5.

Code: Select all

<?php } ?>
- DO NOT FORGET to put this new line afterwards.

And that would be all, except that you would have to put a new line in the coresponding controller file.

For example, if the module that you are playing with has the name of samplemodule, the above codes should be changed in the catalog/view/theme/default/template/module/samplemodule.tpl (default is the name of your template, check if the path is correct. So, that is the template file, i.e. it is how it would look to the visitor.
The line we have to put in the controller file is next:

Code: Select all

$this->data['logged'] = $this->customer->isLogged();
and the file where to put this line would be: catalog/controller/module/samplemodule.php

AND THAT IS ALL.

hope it would help someone.

anyway, here is another interesting similar topic:
http://forum.opencart.com/viewtopic.php ... 3E#p142346

Active Member

Posts

Joined
Mon Jan 31, 2011 10:07 pm
Location - Serbia

Post by info@skatenutter.com » Thu Feb 09, 2012 9:35 am

Hi, This is my first bit of give-back-some-help to the forum as I have found it so helpful to me. I have very little experience with web developing apart from a few evening classes so you will have to excuse my amature approach in explaining this. I have got multi store to work fine for me on my three stores inculding modules across all stores using sub domains. I'm using Version 1.5.1.3. I'll try to explain how I did this as best I can in three steps as follows:

1. In your backend admin panel go to system, settings & create a store named for exampel ' store2 '. Important to use the full url http://www.store2.yourdomain.com/ and very important to use the ' / ' at the end. Enter all your details.

2. Login to the cp (cpanel or Control Panel) of your domain usually ' cp.yourdomain.com ' or ' cpanel.yourdomain.com '. Navigate to the subdomain area and enter. Now enter the subdomain name as choosen earlier for your shop ' store2 ' and click create. The document root should now be called something like ' public_html/store2 '. Rename this to public_html so this now points to the same folder as your already uploaded opencart site (yourdomain.com).

3. In your backend admin panel go to system, design, layouts. Basically you need to copy each layout name and rename the new one with a distinguishing remark e.g. ' Home ' is the original and the copy is ' Home 2 '. You will need to keep the ' Route ' the same so what i did, just to be safe was e.g. first edit ' Home ' and copy the ' Route ' (common/home) ' then cancel out of it, click insert and the first thing i did after that was click ' Add Route ' and paste ' (common/home) '. Then I added the title ' Home 2 ' and I selected my new subdomain store from the drop down menu.

*** Thats it, all should work now *** ;D

To test do thes steps; go to your backend admin panel, extensions, moduels and say for e.g. you want to add the category moduel to your home page on your main domain ' http://www.yourdomain.com ' on the left hand side of the page, click category, ' Add Module ' and from the layout dropdown menu select ' Home ' and select the ' Column Left ' position. The category module will not appear in your new store ' http://www.store2.yourdomain.com ' until you repeat these steps but you may wish to have the category module on the right hand side of the page instead etc. etc. There is probably a simpler way to do it but when you dont know, you just dont know. :)


Posts

Joined
Sat Nov 05, 2011 7:05 am

Post by cwswebdesign » Sun Mar 11, 2012 9:03 am

Thanks for the help! Very useful post!

This account is inactive. Look for us under the name 'EvolveWebHosting' and contact us under that username.

Thanks!


User avatar
Active Member

Posts

Joined
Sun Dec 11, 2011 12:26 am
Location - USA

Post by Qphoria » Sun Mar 11, 2012 9:46 am

I'd like to clarify a bit about this post originally being for "1.4.x".. you could NOT keep modules separate between stores
However, in 1.5.x you CAN keep modules separate.

1. Create Layouts in System->Design->Layouts

2. You should have existing ones like "default" "checkout" "home" etc.
If you edit these you can see there is a "store" selector.

Create separate layouts for your second store and make sure the routes only apply to store 2. Then add modules assigned to this store2 layout. Now you can have modules on store 2 different from store 1.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by cwswebdesign » Fri Mar 23, 2012 9:16 am

Qphoria wrote:I'd like to clarify a bit about this post originally being for "1.4.x".. you could NOT keep modules separate between stores
However, in 1.5.x you CAN keep modules separate.

1. Create Layouts in System->Design->Layouts

2. You should have existing ones like "default" "checkout" "home" etc.
If you edit these you can see there is a "store" selector.

Create separate layouts for your second store and make sure the routes only apply to store 2. Then add modules assigned to this store2 layout. Now you can have modules on store 2 different from store 1.
Thanks for the clarifications!

This account is inactive. Look for us under the name 'EvolveWebHosting' and contact us under that username.

Thanks!


User avatar
Active Member

Posts

Joined
Sun Dec 11, 2011 12:26 am
Location - USA

Post by TraderDan » Mon Jul 09, 2012 2:37 pm

For some strange reason, I can't get any modules to show up on the product pages of my 2nd store, despite having defined all the 'Routes' for my 2nd store in admin > system > design > layouts. Everything works perfectly on my default, and all the modules are showing fine on all the other pages in my 2nd store, just not product pages. I am running 1.5.3.1

Any ideas? This is really starting to drive me nuts.

Image


User avatar
New member

Posts

Joined
Thu Oct 27, 2011 10:44 pm
Location - Lawrence, MA

Post by soundbakes » Thu Mar 21, 2013 11:40 pm

Ok, so i found this thread and info is great... but how do we customize the product selection in the Featured module for each individual multi-store -- so that each store has a different product selection??

More info: We have several multi-stores. All stores have the same product mix but each individual store "manager" needs the ability to choose their specific featured products from that mix and each store needs to be independent from others in this way.

Is there any way to do this?

Thanks in advance for the help!

Newbie

Posts

Joined
Sun Jul 01, 2012 2:31 am

Post by arbex5 » Wed Jun 19, 2013 10:14 am

cwswebdesign wrote:
Qphoria wrote:I'd like to clarify a bit about this post originally being for "1.4.x".. you could NOT keep modules separate between stores
However, in 1.5.x you CAN keep modules separate.

1. Create Layouts in System->Design->Layouts

2. You should have existing ones like "default" "checkout" "home" etc.
If you edit these you can see there is a "store" selector.

Create separate layouts for your second store and make sure the routes only apply to store 2. Then add modules assigned to this store2 layout. Now you can have modules on store 2 different from store 1.
Thanks for the clarifications!
Hi, I could see you can select a different layout, but the module configuration will still the same.
So, what could be done in a case we need to use a module that uses API like YotPo (a review module).

Suppose you have a multi-language website and want to install YotPo. YotPo can only handle one single language. So in a multi-language store the reviews will be on the same for both languages to the one defined on admin panel. It would be interesting if the module could have different configurations based on each store.
Something like store one, module configuration 1, store two, module configuration 2 and so forth.

Is it possible to do it?
Thanks.

Newbie

Posts

Joined
Fri Dec 14, 2012 8:42 pm
Who is online

Users browsing this forum: No registered users and 9 guests