Post by JAY6390 » Thu Apr 28, 2011 9:52 pm

Yeah that's one of my gripes with the multistore too, I've had a few people request multi store control for modules and shipping extensions, and had to make them completely custom to the persons needs

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Xsecrets » Thu Apr 28, 2011 9:57 pm

JAY6390 wrote:Yeah that's one of my gripes with the multistore too, I've had a few people request multi store control for modules and shipping extensions, and had to make them completely custom to the persons needs
yeah now with the layout system since layouts can be assigned to stores that takes care of the multi-store control for standard modules, however payment/shipping modules do not utilize layouts so they will need to be changed to support multi-store control, but since all settings are now saved in one table with a store_id field it should be easy enough to simply add a store dropdown to the payment/shipping modules and get multi-store control for them as well.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Thu Apr 28, 2011 10:02 pm

Xsecrets wrote: here's a question I mentioned it in the bug thread, but I'd like to reiterate it. Would it be possible to go a head and extend the payment/shipping modules to have a store dropdown so you can have different settings for each store in a mulit-store setup. From looking at the code and database it looks like it would be fairly simple to extend them to do that, and with that and the layout system you could have a truly useful multi-store setup.

I've been hesitant to give an answer on this because I don't know the best method or the method daniel will accept.
You could add a store id to each module separately and change the extension query to look for the "featured_store_id" field
or
We could create an extension_to_store table
or my front running idea:
Merge the store table into the setting table by simply adding a "store_id" field to the setting table. The each store can have its own setting without having to make the store controller a subset of the main setting.

On top of that, my other improvement idea for moving the control back into the store and out of the individual modules for things like status, sort order, geozones, and tax... the store selector should also be in this "store controlled" area, not in each individual mod. Then extensions wouldn't have to change at all and would be more future proof and be less work for developers.

So you can see my world is one big brainstorm and it needs to get to the implementation state... but at this point in 1.5 we are in bug mode only to make something stable... and some of these "store controlled" changes are likely more of a 1.6 thing.. So many ideas coming at once.. but hard to make them all work in a day... I'm trying my best to get this all sorted... i really am.. but I think there are a lot of changes that we can't all cram in at once and some that daniel isn't on board with yet which is typically the hardest sell.

So i really don't know what to say.. I guess for now if you really need it, you may have to work some hackery to make the module store specific from within the module itself, until we can get a handle on ripping it all out from the module

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Thu Apr 28, 2011 10:05 pm

Qphoria wrote: or my front running idea:
Merge the store table into the setting table by simply adding a "store_id" field to the setting table. The each store can have its own setting without having to make the store controller a subset of the main setting.
have you looked at the database on 1.5.0 that is already done. all settings are now in the settings table and it has a store_id field.

that's why I'm saying adding the multi-store support to the payment/shipping modules should be very easy now.

seems like all you would have to do is add a store dropdown and then take the value from that and pass it as the third argument to the editsettings function.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by JAY6390 » Thu Apr 28, 2011 10:09 pm

True enough, the only question is how would you decide which store's modules is being edited? when it comes to editing?

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Xsecrets » Thu Apr 28, 2011 10:15 pm

JAY6390 wrote:True enough, the only question is how would you decide which store's modules is being edited? when it comes to editing?
my idea was simply add another field with a store dropdown that has the store id as the value. then if you want to edit the settings for the second store you change the drop down and change the settings. I think that would be good enough for now. Of course at some point you would want to write some javascript that update all the field on the dropdown change, but that can be added later if we want to get it in quickly.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Thu Apr 28, 2011 10:15 pm

Xsecrets wrote:
Qphoria wrote: or my front running idea:
Merge the store table into the setting table by simply adding a "store_id" field to the setting table. The each store can have its own setting without having to make the store controller a subset of the main setting.
have you looked at the database on 1.5.0 that is already done. all settings are now in the settings table and it has a store_id field.

that's why I'm saying adding the multi-store support to the payment/shipping modules should be very easy now.

seems like all you would have to do is add a store dropdown and then take the value from that and pass it as the third argument to the editsettings function.
lol shit.. you are evidently more ahead of the game than I at this point.. I'm lost in a sea of bugs right now and haven't had a chance to even look at the new code or db structure.

Well then that changes things. I guess he was listening :P
I guess then the question is where do we add a store-to-extension control point.. I'd rather not put it into the individual extension but without having the common store control area for extensions in place, that may be the only place to put it.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Fri Apr 29, 2011 9:31 pm

So maybe a "manager" type mod for extensions that has store selection.
An extension_to_store table would be needed.. and then a query to link the settings table for each individual store_id may be best to avoid having to add it to each individual module

extension_to_store
|_ extension_id
|_ store_id

Then the query to pull the extension would be something like:

Code: Select all

select * from extension_to_store e2s left join extension e ON (e2s.extension_id = e.extension_id) left join setting s ON (e.code = s.group) where store_id = $this->store_id

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Tue May 10, 2011 11:20 am

Well Daniel has officially rejected my original post for items 2 and 3 but has OK'd item 1 ::)

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by i2Paq » Tue May 10, 2011 2:09 pm

Qphoria wrote:Well Daniel has officially rejected my original post for items 2 and 3 but has OK'd item 1 ::)
Patient my young Skywalker, everything started with one ;D

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by marc_cole » Tue May 10, 2011 10:39 pm

Qphoria wrote:Well Daniel has officially rejected my original post for items 2 and 3 but has OK'd item 1 ::)
That's unfortunate. You made a good case for your proposals and they made sense to me; fewer lines of code with the same functionality — what could be better than that?

What was his reasoning for not wanting to adopt the other two?

OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by affect » Wed Aug 17, 2011 7:29 pm

Not sure if it has to go here, or to bugs thread or feature requests, but:

editSetting() function should really edit the settings passed instead of deleting all settings from the group and reinserting settings passed.

Now it's impossible to edit one or several settings without touching everything else, the only way is to load all settings, modify the ones that need to be modified and call the editSetting() function.

This approach is more complicated since it makes one load all settings every time something has to be changed. It also leads to unneeded database queries, although that's not such a big issue for settings.

Furthermore, it makes it really difficult to split module configuration template into multiple parts with several forms since if you submit one form, the settings from other forms get erased and the only way to keep them intact is to manually load the settings that didn't get posted from the database before calling the editSetting() function.

Totally inconvenient.

MultiMerch Marketplace for OpenCart

Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by OSWorX » Wed Aug 17, 2011 8:57 pm

affect wrote:Furthermore, it makes it really difficult to split module configuration template into multiple parts with several forms since if you submit one form, the settings from other forms get erased and the only way to keep them intact is to manually load the settings that didn't get posted from the database before calling the editSetting() function.
Basically I am with you.
Except the last (see quote) part.
Easy to write inside your module/extension a very simple function/routine where only those config vars will be edited/stored.
With this new function it is also easy to edit only and not - like now - delete first and store afterwards.

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by affect » Wed Aug 17, 2011 9:10 pm

Yeah I agree, just realized that, wrote a custom function to do it.

While doing that I also found out settings table doesn't have unique index set, so it's impossible to use REPLACE to edit settings.

If I understand the logic correctly, unique should be set on (store_id,group,key) since that combination must be unique. Then it'd be possible to just use

Code: Select all

"REPLACE INTO " . DB_PREFIX . "setting SET store_id = '" . (int)$store_id . "', `group` = '" . $this->db->escape($group) . "', `key` = '" . $this->db->escape($key) . "', `value` = '" . $this->db->escape($value) . "'"
and not build setting arrays manually or delete everything from the db at least in mysql. Since unique isn't set, that won't work now.

MultiMerch Marketplace for OpenCart

Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by rph » Wed Aug 17, 2011 10:25 pm

affect wrote:Not sure if it has to go here, or to bugs thread or feature requests, but:

editSetting() function should really edit the settings passed instead of deleting all settings from the group and reinserting settings passed.

Now it's impossible to edit one or several settings without touching everything else, the only way is to load all settings, modify the ones that need to be modified and call the editSetting() function.
It's been that way since at least 1.4.x.

Out of curiosity, why do you think this is an issue? The only time I can see this adding work is if you want to make a change outside the extension.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by OSWorX » Wed Aug 17, 2011 10:34 pm

rph wrote:It's been that way since at least 1.4.x.
And because it is there as it is, it has to be correct?
rph wrote: Out of curiosity, why do you think this is an issue? The only time I can see this adding work is if you want to make a change outside the extension.
Exact!
The more you develop, the more you may change a setting outside the extension it is for.

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by Xsecrets » Wed Aug 17, 2011 10:56 pm

OSWorX wrote: Exact!
The more you develop, the more you may change a setting outside the extension it is for.
I think he was basically asking why in the world you would ever need to do this, and you act like it's something an inexperienced developer would ask, though I have a very hard time imagining any need to do it, and I've been developing for quite a while.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by affect » Thu Aug 18, 2011 12:13 am

Out of curiosity, why do you think this is an issue? The only time I can see this adding work is if you want to make a change outside the extension.
Not really outside, mostly when splitting module config into parts. Let's say I have a module that has multiple logical configuration parts, for example it has some configuration variables, positions (layouts) and beside that it lists and allows adding/removing records from the database.

I'm used to list it everything on a single screen, but since those are different parts I have multiple forms and submit buttons (e.g. a user can insert a db record and still stay in the config screen).

Since it happens in one form, everything else doesn't get posted, so I either need to collect all data from all forms manually via js or first load ALL settings in the controller to an array and then only change the ones I need. Only then I can pass the array to editSettings and be sure they are all intact. That adds work.

UPD
The only situation where deleting and reinserting settings can be of a use is when it's possible to delete some of module's settings entirely like positions in OC < 1.5.1 where every position had 4 settings. But since that behavior changed in 1.5.1 I can't think of a situation where deleting/inserting and more db queries can be more convenient and effective than updating. Maybe I'm wrong, though.

MultiMerch Marketplace for OpenCart

Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by Qphoria » Thu Aug 18, 2011 12:51 am

A lot of places use Delete/insert instead of update simply because its easier in situtations where maintaining the id isn't important. The settings table is one of them... setting_id isn't used anywhere programmatically. This has been so since the 0.x versions even.

Not to say it's wrong or right.... but hasn't had any negative effect thus far.

You could make the complaint for the product_options table however, as that does cause saved carts to lose the options

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Thu Aug 18, 2011 1:08 am

I agree that it is not exactly a top priority, but should for any strange reason it be necessary to edit a specific setting value, it would be nice to have a simple method where you give the store id, group, key and value, and be able to update it without having to create your own function

I'm agreeing also that as Xsecrets has said, it's not a feature I've needed ever since programming with opencart as such, so finding it a little difficult to see a great benefit

The product options one to me is a much bigger issue, and could be resolved pretty easily IMO

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 4 guests