Latest News: (loading..)
Sign in to follow this  
Followers 0
foxp2

shared classes between two Site

8 posts in this topic

Hi Harald,

 

another question.

in my scenario, i've cloned Admin Site with PublicAdmin Site.

for :

 

ApplicationAbstract.php

CategoryTree.php

Controller.php

Image.php

IndexModulesAbstract.php

Language.php

MessageStack.php

OrderTotal.php

PaymentModuleAbstract.php

ProductAttributeModuleAbstract.php

ServiceAbstract.php

Shipping.php

Tax.php

Template.php

 

my understanding is that these classes could be shared between these two Site :

 

 

 

Are you agree with this structure ?

 

Usually, i shouldn't cloned these classes in my PublicAdmin Site.

Edited by foxp2

Share this post


Link to post
Share on other sites

Hi Laurent..

 

There is no need to duplicate code in that scenario. Calling the original classes should be fine. You will need to reference some classes though, example:

 

Admin\Controller calls MessageStack() from the same namespace osCommerce\OM\Core\Site\Admin. As you are in a different namespace, you will need to add

 

use osCommerce\OM\Core\Site\Admin\MessageStack;

 

to PublicAdmin\Controller so it uses the correct class.

 

Kind regards,

Edited by Harald Ponce de Leon

Share this post


Link to post
Share on other sites

Hi Harald,

 

thank you for your answer.

 

 

But once again, we have the same problem : too hardcoded code in these classes.

eg :

in \osCommerce\OM\Core\Site\Admin\Controller.php

     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';

 

should be :

 

     $application = 'osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';

because my Application are in PublicSite

 

We have also a lot of OSCOM::callDB('Admin\ ...

instead of OSCOM::callDB(OSCOM::getSite()

 

I'm alright or i'm stupid ? :'(

Share this post


Link to post
Share on other sites

Hi Laurent..

 

The $application line could be updated to use OSCOM::getSite() which can help in your scenario, however the OSCOM::callDB() lines should be left hardcoded to make sure the right classes are being called.

 

If this does not meet your needs, you will need to write your own Site Controller and not base it off an existing one.

 

Kind regards,

Edited by Harald Ponce de Leon

Share this post


Link to post
Share on other sites

Hi Harald,

ok, but IMO, once again ,I reach a limit in the flexibility. :wacko:

Share this post


Link to post
Share on other sites

Hi Laurent..

 

First step: Get your code working

Second step: Look where the core framework can be improved (to remove flexibility limits)

Third step: Propose changes to the core framework

 

:thumbsup:

 

Kind regards,

Edited by Harald Ponce de Leon

Share this post


Link to post
Share on other sites

 

 

First step: Get your code working

 

:angry:

my code works ! ok ? so, avoid to be patronizing with me.

i just want to optimize my dev.

Share this post


Link to post
Share on other sites

Second step: Look where the core framework can be improved (to remove flexibility limits)

Third step: Propose changes to the core framework

 

I'm quite happy to participate in improvements , but i will not to do the work at your place.

My feeling is that, in this regard, I'm proceeding almost without any safety net, without documentation. Be aware of this.

The improvements and modifications on framework is your job.

Because it's your project, your future app store.

Please, do not switch roles.

:angry:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0