Vue Js - Vuex Store Scenario - vue.js

I am working on a Vue JS project and want to ask a conceptual scenario based Question .
So I have 3 modules in the Project.
Module A
Module B
Module C
Each Module has a separate Store . There is one object called Record in each of these Modules. Although each Module in separately maintaining this object (Record) but on the backend (webApi and Services) its a same entity .
Now there is another Module (Module 4) which basically allow user to view and update that object (Record) . And that module in opening in a new window ( i am using vue router- target_blank command to open module object in new tab)
My question is that when the user interacts with that object (Record) in module 4 and change some of its properties , i want other modules to reflect these changes . Currently i need to refresh to update the changes on (Module A, Module B, Module C) .
How can I achieve this ? System is designed to open module 4 in new window and I don't want to change that .

Related

Prestashop module development: How can we save data from product page?

I'm here for help from those who have real experience in Prestashop module development.
I got stucked while saving data from the product page where I've created the field through the module via hookDisplayAdminProductsExtra.
And I didn't get an idea to save new field data from the admin product page.
So, please help if anyone has a solution for this.
Thank You.
Add a form in your hook returned TPL,
so that you can retrieve and save your custom data in DB by registering and triggering "actionProductUpdate" in the module (this hook is called when a product is saved) by using Tools::getValue() inside the hook on your POST data.
Other solution would be to save data in AJAX with a dedicated AdminController - You can insert a custom button in your TPL + an additional JS file (you can include it with hookBackofficeHeader) to trigger the AJAX call.
You can see more about AdminController in official devdocs.

Is there any way to compact app.js file in vuejs

I am using vuejs with laravel blade file (laravel mix too). But When i run ‘npm run watch’ on local, it built about 13 MB of app.js !
When i run ‘npm run pord’ on server it makes 6 mb !
So, the users face slowness every time i deploy new task.
I have few role permission (main panel and school panel).
Main panel has full control over all things. But school panel has few component.
We use blade file which call a master component and master component may have one or more components that are SPA(Tab based). Means when user click other tab it loads another component but if the user click on sidebar menu the page (laravel blade file) reloads and load another page with tabs.
I don’t need to load all component for school panel as this panel has limited permission.
Is there any way so that i can load component specific js file instead of one js(app.js) file?
Is there any way to compact all packages in single file and component file in another js file?(as whenever i deploy changes user have to download whole js file again)
You start with changing your build, so it creates two bundles:
app.d1f04bb8.js (your code)
vendor.b9f38bcd.js (libraries)
both are cached, so when you do small change -- user will need to load only new app.js.
You can go further and make more vendor bundles, more app bundles, lazy-load bundles etc. -- which one you need is very specific.
P.S. Of course, make sure that your code is minified.

i am adding custom html free version in my prestashop 1.7

I have added one module custom html box in PrestaShop 1.7 . Module is installed but you can use it only once .can i create multiple list of htmlbox?
This depend on the module, but if you are using htmlbox module, yes, the free version is programmed to only be used 1 time in 1 place.
But there are two options to do this without any developed module.
1st option:
You have the option to include these html code directly in the tpl of the activated theme.
In prestashop 1.7 version we have a new feature that, if you are in mode developer ("Advanced parameter" -> "Performance"), in the html you can see in what template is located any element.
For example, to add a code above the slider of the home page, if you inspect the element you can see this:
In the "begin" tag you have the template that you need to modify.
2nd option:
You can create a new module and use the display hooks correctly.
Here you have all that you need to know about the creation of modules.
http://developers.prestashop.com/module/05-CreatingAPrestaShop17Module/

Yii framework module layout issue

I am creating my first framework based project using YII framework. I have a main site and a module based backend to manage the site(CMS). First I used the same layout for both ends, but now I want two different layouts for front end and backend. I changed my module layout by adding a layouts folder to the module view file and I added “$controller->layout = 'main';” to the base module file of my module folder. Now the layout has been changed but when I logged in as a admin to the backend I cannot view any admin controller action, it means I am just a guest user. This issue is solved when I change my layout to the main site layout.
Please let me know if there is anything to do for this?
if the backend and frontend you created like module I think this will help:
$this->layoutPath = Yii::getPathOfAlias('(application.views.layouts or path/to/layouts)');
and in controllers of module just pasting layout name:
public $layout = 'login';

Is it good to duplicate the opencart module?

Well I want to make a custom page in opencart admin panel to insert and delete some data from opencart database
For example :
Set an image slider on opencart home page and fetching images from database & for insertion of images, I want to create a custom page in opencart admin panel ??
So how can it be possible ??
You can duplicate any module and create other for your needs. Remember to duplicate and change the filename so the "new" extension can work properly.
Folder to consider for admin:
admin->controller->{type of module}->module's name
admin->model->(type of module)->module's name
admin->language->english (always)->(type of module)->module's name
optional:
admin->language->(other languages)->(type of module)->module's name
you may try,
1,Login as Admin-> systems -> design ->banners -> insert ->
YOUR BANNER NAME-> add banner ->
Title: YOUR TITLE
Image: YOUR IMAGE -> Save
2, Login as Admin-> extensions -> Modules ->Slideshow -> Edit -> add Module -> SELECT YOUR BANNER -> Save
Also when duplicating modules be aware that you may also need to change the existing class name to different one. For example when duplicating module flat rate you will also need to change in the controller /admin/controller/shipping/flat.php :
class ControllerShippingFlat extends Controller {
to something new like :
class ControllerShippingFlatDuplicate extends Controller {
It's posible, but in my opinion if you want to create a new "admin page" in your Opencart you can do it using vqmod.
so, you don't have to rewrite any core file.
you can donwload any free extension on the opencart website to take an example
You can simply duplicate some simple modules available in opencart admin panel like Welcome module or Banner or Slideshow module.
This method will help you to disable the module or change the position of content in future.
Duplicating opencart module tutorial : http://opencart.hostjars.com/blog/58
As a beginner it's better to duplicate an existing module and modifying it as per requirement. When you get the idea of how opencart modules work, you can build modules from scratch.
Yes, it is pretty safe and sound to duplicate a module in opencart and it is a bit logical with any of the cms as no one is going to create a module from scratch for a very little functionality like inserting some values to database.
As depicts you just want to insert some images links, so you can proceed with replicating the catalog / information functionality in opencart admin panel.
You just need to create a new table in database to store new modules data and fetching new module data in front end.
If you want to create a custom module or custom page for your store you can check below link. There is complete solutions for your question and describe very deeply.
Create custom module: http://www.php-dev-zone.com/2015/02/opencart-custom-module-development.html