Packages
8
Downloads
803
Автор дополнения
Packages
8
Downloads
803
Version 0.3.8-beta
Release date 02.17.2018
Downloads 163
Views 135
Warning! This package requires MODX not less than 2.3 !

Описание

Add linked products as additional options with an increase in the price of the goods you add.
In any form of adding goods to the shopping cart, you can display additional items that will be added as options with a subsequent price increase.
The added options are displayed in the shopping cart near the item.

IMPORTANT: in the linked products list only those products are displayed for which the current item or the specified snippet of msAddLinked.input is the main

msAddLinked.input snippet

For displaying a list of additional goods and input fields. By default, checkboxes are displayed, but, in theory, you can specify any type that is supported by the attribute type of the tag input.
The correct operation of the types text, number. If you specify a number in these input fields, the options to the product in the cart will be added in the appropriate quantity.

<cut />
Options
NameDefault value
Description
&tpl
tpl.msAddLinked.inputChunk of design
&product0 (Current Item)Main Goods ID
&link0 (All links)link ID
&inputTypecheckboxType of the input field for each linked item
&priceTarget#priceThe HTML element selector to insert the changed price
&priceOrigTarget#msal_price_originalThe element's HTML selector to get the original price
&fieldName pagetitleThe resource field for displaying the name
&toPlaceholder0If this parameter is specified, the result will be stored in the placeholder, instead of the direct output on the page


msAddLinked.info snippet

It is used to display the list of options added to the product in the cart and in the letters.


Options


NameDefault value
Description
&tpl
tpl.msAddLinked.inputChunk of design
&key0 (Current Item)Item Key
&fieldName pagetitleThe resource field for displaying the name.


Example of a call:
[[!msAddLinked.info? &option=`[[+option.msal]]`]]

In the Fenom Fenom:
{$_modx->runSnippet('msAddLinked.info', ['option' => $product.options.msal])}

If other items options are displayed in the cart, then the following block:

{foreach $product.options as $option}
    {var $options = $options ~ $option ~ '; '}
{/foreach}
or
{$product.options | join : '; '}
must be replaced by the following:

{foreach $product.options as $k => $option}
    {if $k != 'msal'}
        {var $options = $options ~ $option ~ '; '}
    {else}
        {$_modx->runSnippet('msAddLinked.info', ['option' => $product.options.msal])}
    {/if}
{/foreach}

System settings

NameDefault value
Description
&msal_frontend_js
[[+jsUrl]]web/default.jsThe path to the JS file
&msal_variablemsalName of variable in options


Discuss it in MODX.PRO community.

0.3.6-beta

  • Fixed ability to show option cost instead of price

0.3.5-pl

  • Fix &showCost snippet parameter

0.3.4-pl

  • Added ability to show option cost instead of price

0.3.3-pl

  • Added ability to format prices by MS2
  • Small fix PHP notify in msAddLinked.info snippet

0.3.2-pl

  • JS fix for JQuery 3.0+

0.3.1-beta

  • Added ability to store info about options in order comment
  • Some small fixes

0.3.0-beta2

  • Some small fixes

0.3.0-beta

  • Added ability to use with pdoPage and mSearch2

0.2.1-pl

  • Fixed calculate price if no options found

0.2.0-pl3

  • Added ability to recalculate price at document ready event

0.2.0-pl2

  • Fixed use of an array of field names

0.2.0-pl

  • Added ability to use discount for options

0.1.0-pl

  • Added ability to use input radio

0.1.0-rc

  • Optimized logic and elements
  • Removed unnecessary snippet msAddLinked.Cart and outer chunks

0.1.0-beta2

  • Added price formatting at front-end
  • Fixed system settings

0.1.0-beta

  • Public release