⬆️ ⬇️

Shopkeeper 2.0 beta1 for MODX Revolution released



The development of the Shopkeeper module for MODx Revolution continues. This module (and snippet) is already known to many and is used at MODx Evolution to create online stores.

In addition to transferring Shopkiper to Revo, a full code refactoring is planned taking into account the accumulated experience. But now you can use the beta1 version to create a simple shop.



What is already done:











')





Installing the package is very simple:

  1. Download the shopkeeper-2.0-beat1.transport.zip archive to the core / packages / folder of your site.

  2. In the control panel, go to "System" -> "Package Management" -> "Add a new package" -> "Search for packages locally " -> "Next" .

  3. The package “shopkeeper” will appear in the package table. Click the "Install" button.

  4. Finish the installation.




As before, pre-made add-ons for MODX are used to the maximum. To output products, use the getResources snippet. To send an order to the post office and to the order management system, use the FormIt snippet. For registration and authorization, you can use the Login snippet. The kit also includes a shk_fihook snippet, which is used as a hook for FormIt , as well as a contextSwitch plugin for switching contexts.



Placing goods in a separate context is not necessary, but is recommended if a lot of goods are planned (more than 2000). This allows the directory to make individual settings, for example, if necessary, disable friendly URLs (friendly_urls).

In general, a separate context is almost the same as a separate database table in Evolution. I have not tested the speed of work with a large number of products (MODX resources), but with friendly_urls disabled (as a temporary solution) there should be no problems.







Creating context for products:

  1. in the menu go to "System" -> "Contexts", click "Create New". In the "Context Key" enter "catalog". Then click the right button on the context line in the list and select "Update context".
  2. Context Settings:

    site_start: 20

    error_page: 21

    unauthorized_page: 22

    where 20 is the catalog document ID, 21 is page 404, 22 is page 403 (access denied).

  3. Create in the context of the "catalog" document container "Catalog". Inside create a directory structure.

  4. In the context “web” create a document link “Catalog”, in the field “Link” enter “catalog /”.
  5. If friendly URLs and Apache server are used, in .htaccess replace the string

    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 
    on

     RewriteRule ^(catalog)?(\/)?(.*)$ index.php?c=$1&q=$1$2$3 [L,QSA] 


  6. Check that the contextSwitch plugin has been installed (core / components / shopkeeper / elements / plugins / context_switch.php).


Sample Callkeeper Snippet Call:



 [[!Shopkeeper? &cartType=`full`&flyToCart=`image`&orderFormPage=`12`]] 




The withdrawal of goods from the context of "catalog":



 [[!getResources? &context=`catalog` &tplPath=`[[++core_path]]components/shopkeeper/elements/chunks/ru/` &tpl=`@FILE chunk_shopStuff.tpl` &includeTVs=`1` &parents=`9` ]] 




Updated

The beta3 version is already available (can be downloaded from the control panel).

Source: https://habr.com/ru/post/123126/



All Articles