http://modx-shopkeeper.ru/


Translated by kp52.

Snippet Shopkeeper 0.9.5 for MODx

MODx Internet Store

Description

Snippet displays two types of shopping basket (extended or simple). Message with order details can be emailed and sent to the Shopkeeper module (recommended). Additional parameters can be attached to goods for the user to select. The eForm snippet is required for creation of the order form.

Installation SHK 1.x

  1. Upload the extracted folder shopkeeper to assets/snippets
  2. Copy Move the extracted folder install/ to the root of your site.
  3. Copy the files contained within _upload/assets/ to the relevant folders (images, Templates, plugins, within assets folder, place catalog view within snippets
  4. Start the installation Shopkeeper, typing in the address bar of your browser: http://[site's domain]/install/. you might have to type install/index.php to make it install
  5. You can select the components of the Shopkeeper, as well as install the demo site. Complete the installation.
  6. Sign into the control panel website (http://[site's domain]/manager/). If immediately opens the configuration of the site, click on "Save."
  7. Create a section of the catalog product pages. It can be domumenty MODx or catalog goods Shopkeeper. To button appears in the directory, enter in the "configuration" and fill in the "Category directory by default" (ID domumenta).
  8. Delete the folder install/. Done.

Widgets for product parameters

To create widgets (drop-down lists, radio buttons, checkboxes), the snippet SHKwidget (on the product description page) and a Ditto extender (in the product listing) are used. See eng_doc_SHKwidget.html и eng_doc_ditto_extender.html for details.

Updating

Replace all the files and source code (including chunks). Uninstall and reinstall the module Shopkeeper.


Snippet parameters

Параметр Description and values Default value Note
&lang language manager language currently available languages:
`russian`, `english`, `german`, `francais`
&style basket style `default`
(assets/snippets/shopkeeper/style/default/)
&style=`0` - if you do not want to use a separate stylesheet for the basket
&cartType Type of basket
`full` - extended,
`small` - simple,
`empty` - clear the basket without displaying anything
`full`  
&currency currency `руб.` (for roubles)  
&priceTV name of TV, which is used for the price. `price` If your TV for the price has no name "price", required specify the name in this parameter.
&orderFormPage ID of page containing order form `1` Mandatory parameter
&noJQuery=`1` if Jquery library is already in use on your site `0`  
&noConflict=`1` if another JavaScript library (not Jquery) is in use on the site `0`  
&noCounter hide (`1`) or show (`0`) the goods counter when adding to the basket `0`  
&linkAllow=`0` Displays the name of goods in the shopping cart, e-mail and module without links. `1`
&stuffCont CSS-selector of the container element for product information. `div.shk-item` Chunk example: chunk_shopStuff.tpl
&debug=`1` launch debugger for JavaScript functions (display information) `0`  
&cartTpl basket template chunk `@FILE:assets/snippets/shopkeeper/ install/examples/ru/chunk_shopCart.tpl` The chunk contains three templates, for empty and for populated extended and simple baskets.
If the chunks are stored in files, you can specify the path with the command "@FILE:". If the chunks are created in the manager, then specify only the name of chunk (eg &cartTpl=`shopCart`)
&cartRowTpl template chunk for line of product information in extended basket -  
&cartHelperTpl "helper" template chunk - block element displayed to confirm actions -  
&additDataTpl chunk of additional parameters for items in your cart ([+addit_data+]) -  
&orderDataTpl chunk list of items in the report of the order ([+orderData+]) - used in a letter to the report of the order (eForm &report) and in the module.
&flyToCart action on adding product to basket:
`helper` - counter showing quantity of goods appears and jumps into the basket,
`image` - image of the product jumps into the basket (not currently implemented),
`nofly` - nothing jumps into the basket;
`helper` If &flyToCart=`image` tag <img> should have a CSS-class "shk-image"
&noLoader=`1` not show preloader `0`  
&changePrice=`1` when changing price parameters, product price changes, but amount of change is not displayed `0`  
&counterField=`1` add pointer for more/less to all <input name="shk-count"> (goods quantity) fields `0`  
&noJavaScript=`1` Work without JavaScript. `0` Note that in the chunk "shopCart" "Calculate" button located inside the tag "noscript". If you use mode &noJavaScript=`1`, it is recommended tag "noscript" delete.

Sample calls

[!Shopkeeper? &priceTV=`price`&orderFormPage=`10`!]

[!Shopkeeper? &cartType=`small`&priceTV=`price`&orderFormPage=`10`&changePrice=`1`&counterField=`1`&flyToCart=`nofly`!]

Templates and placeholders

Snippet parameters Description Placeholders in template Notes
&cartTpl (&cartType=`full`) Extended basket template [+inner+] - Line of product information (cartRowTpl)
[+price_total+] - Total sum
[+this_page_url+] - URL of current page
[+order_page_url+] - URL of order form page
[+currency+] - currency
Example: chunk_shopCart.tpl
(contains three basket templates)

<!--tpl_separator--> - is separator between templates
&cartTpl (&cartType=`small`) Simple basket template [+price_total+] - Total sum
[+total_items+] - Number of items selected
[+plural+] - Make "item" plural, depending on number of items chosen
[+this_page_url+] - URL of current page
[+order_page_url+] - URL of order form page
[+currency+] - currency
&cartRowTpl Template for product information line in extended basket [+id+] - product (document) ID
[+name+] - product name
[+link+] - link to this product's webpage
[+addit_data+] - additional product information
[+price+] - price
[+currency+] - currency
[+count+] - quantity
[+this_page_url+] - URL of current page
[+index+] - item's position in the basket (starts from zero)
Example: chunk_shopCartRow.tpl
&additDataTpl chunk of additional parameters for items in your cart ([+addit_data+]) [+param+] - name and price parameter. Price indicated in parentheses. If a price = 0, then write only the name of the parameter (without the parentheses).
[+name+] - name parameter.
[+price+] - price parameter.
Example: chunk_additDataTpl.tpl
&orderDataTpl chunk list of items in the report of the order ([+orderData+]) Все плейсхолдеры чанка &cartRowTpl

[+loop+], [+end_loop+] - beginning and end of the line of data products (cycle).
Example: chunk_orderDataTpl.tpl
&report (eForm) template for text of message describing order details [+orderData+] - order details (list of purchases) Examples: chunk_shopOrderReport.tpl, chunk_shopOrderReportWebUser.tpl

Order form

The order form is produced using the eForm snippet. The following parameters must be specified in the snippet call:

&gotoid - ID of the page to go to after the order is submitted (required for clearing the basket);
&eFormOnBeforeMailSent=`populateOrderData` - function for filling in details of the selected goods

In order for orders to be sent off to the Shopkeeper module, the parameter &eFormOnMailSent=`sendOrderToManager` must be included in the eForm snippet call.

Sample eForm call:

[!eForm? &formid=`shopOrderForm`&tpl=`shopOrderForm`&report=`shopOrderReport`&vericode=`1`&ccsender=`1`&gotoid=`11`&subject=`New order`&eFormOnBeforeMailSent=`populateOrderData`&eFormOnMailSent=`sendOrderToManager`!]

Connecting the system of payment

To connect the system of payment (receipts and statements, etc.) can make an additional snippet, which may use session variables that are created after you submit your order:

$_SESSION['shk_order_id'] - ID Order in a database;
$_SESSION['shk_payment_method'] - chosen method of payment (list with name="payment");
$_SESSION['shk_order_price'] - Total price;
$_SESSION['shk_currency'] - currency;
$_SESSION['shk_order_user_id'] - ID Users (if not registered = 0); $_SESSION['shk_order_user_email'] - e-mail address of the payer (if not registered).

Important points

All examples are included in the shopkeeper/install/ folder.


It is recommended that you use the PHx plugin (http://modxcms.com/extras/package/?package=342) to position the basket in different positions on pages, or make different templates for the pages.

The Ditto snippet is normally used to display the products.

Use additional TV parameters (e.g. [*price*]) to show prices.

Warnings and disclaimers

There is an element of risk associated with the fact that the snippet performs database (read and write) operations. The author has attempted to protect against the most widespread methods of breaking the system, but anything can happen... You make use of this code at your own risk. The author accepts no responsibility for the consequences.