new

msOptionsPrice2

Extra prices for goods with different characteristics and accounting balances
Packages
41
Downloads
12 774
Автор дополнения
Packages
41
Downloads
12 774
Version 2.5.8-beta
Release date 06.01.2018
Downloads 2 901
Views 498
Warning! This package requires MODX not less than 2.3 !
[msOptionsPrice2] — New version with product modifications.

Cardinally different from the previous one, it's not enough to simply update.
In general, the component also works with product options, but now options are tied to product modifications. Also, you can attribute to modifications your article, weight, quantity and of course price. All product options are available.



In advance I apologize for the inability to upgrade from the old version..

Product Modifications
The product page has the same tab (setting msoptionsprice_working_templates, in it, list the id of the required templates). You can create / modify product modifications.



All product options are available for modification.



Snippet msOptionsPrice.initialize
Designed to connect styles and scripts on the front of the site.
It's enough to call a snippet in the product template.

[[!msOptionsPrice.initialize?]]

The default script tracks the change in the product form and loads the modification data. To run the script, you need to add the necessary classes, an example of the chunk of the product is gist.github.com/vgrish/b6998560c6a64c0f34109a9e632b9b56

product form — msoptionsprice-product
product cost — msoptionsprice-cost msoptionsprice — [[* id]]
article number — msoptionsprice-article msoptionsprice — [[* id]]
product weight — msoptionsprice-weight msoptionsprice — [[* id]]

Snippet msOptionsPrice.modification
Designed to display product modifications. Often it is required to separately display information about various product modifications, now it is quite simple to do. You need to call a snippet

[[!msOptionsPrice.modification?]]



Modification picture
You can add a picture of the product modification. Images are available from the product gallery.

In the gallery chunk you need to add IDs
data-rid="{$file['product_id']}" data-iid="{$file['id']}"
chunk example gist.github.com/vgrish/e5c7e541b33eefc4b7c0cb68ec389096
Default script works with the gallery fotorama.

Processing of the old product price
In the case of product modifications, the difference can be very significant and almost always its amount looks illogical. Therefore, processing of the old product price was added.
The calculation logic is very simple
product price old product price-----------------------------------------=            -----------------------------------------price of product modification old price of product modification
(product price / old product price = product modification price / old product modification price)
It is enough to put the old price in the main product field and the old modification cost will be automatically calculated.
To change at the front, you need to add the necessary classes. An example of a chunk of the product is here gist.github.com/vgrish/b6998560c6a64c0f34109a9e632b9b56#file-gistfile1-txt-L22
In the msOptionsPrice.modification snippet, the field old_price is also available.

Copy of the modification
A processor to copy the modification is added.


Preview in the cart
To display the preview of the modification in the shopping cart you can use the following construction:
gist.github.com/vgrish/3748714377be39401799e3908efd8a59#file-mscart-tpl-L22-L35

Functional of related options.
Quite often there arises the question of displaying certain options depending on the other, now this functional is out of the box.


This functional implements msOptionsPrice.option snippet, it is similar to msOptions snippet and serves for displaying options for product modifications.
The parameter constraintOptions has been added — it is used to set options restrictions, it is specified in json format, or directly as an array.

Example call
{'msOptionsPrice.option' | snippet : [
'options' => 'phytomodule_color,equipment,frame_color',
'tpl' => 'phytomodule.option',
'processColors' => 1,
'constraintOptions' => [
    'phytomodule_color' => ['sizes'],
    'equipment' => ['sizes','phytomodule_color'],
    'frame_color' => ['sizes','phytomodule_color','equipment']
]
]}


In this case, we indicate that:
— the option phytomodule_color depends on sizes option
— the equipment option depends on the sizes option and phytomodule_color
— the option frame_color depends on the options sizes and phytomodule_color and equipment

Example chunk options
{foreach $options as $name => $values}
    <div class="sm-text"><b>{('ms2_product_' ~ $name) | lexicon}</b></div>
    <div
        {if $constraints[$name]}
            data-constraints="{$constraints[$name]| json_encode: 256 | htmlentities}"
        {/if}
        >
        {foreach $values as $value index=$index}
         
        <label class="input-parent">
        <input type="radio" value="{$values[$index]}" name="options[{$name}]" 
            {if $index == 0}checked="checked"{/if}
            
            {if $constraints[$name]}
                data-relations="{$relations[$name][$value]| json_encode: 256 | htmlentities}"
            {/if}
                    
            />
            {$values[$index]}
        </label>
    
        {/foreach}
    </div>
{/foreach}


data-constraints — we set options constraints
data-relations — we set the connection options
input-parent — class, is required to hide / display a container with an option

Similarly, selects and outputs selections

{foreach $options as $name => $values}
    <div class="form-group">
        <label class="col-md-2 control-label" for="option_{$name}">{('ms2_product_' ~ $name) | lexicon}:</label>
        <div class="col-md-10">
              
            <select name="options[{$name}]" class="input-sm form-control" id="option_{$name}"
                {if $constraints[$name]}
                    data-constraints="{$constraints[$name]| json_encode: 256 | htmlentities}"
                {/if}
                >
                {foreach $values as $value index=$index }
                    <option value="{$value}"
                     
                    {if $constraints[$name]}
                        data-relations="{$relations[$name][$value]| json_encode: 256 | htmlentities}"
                    {/if}
                         
                    >{$value}</option>
                {/foreach}
            </select>
        </div>
    </div>
{/foreach}

example: s6200.h3.modhost.pro/6/12010.html

Product options
Improved work with product options. There is no need to create options first, and then switch to modifications. You can create / delete product options directly from the modification. In general, this is all the information, both versions will be available in the repository at once. The new one can only be installed on a clean system, where previously there was no old version. In the new version there is not any work with the remainders, all this will be after at least a small break-in of the component.

Do not try to upgrade!!! If you are not sure what it is you need.

ps. Thank you all for your attention. The new version is compatible with the package Discontrol.

Example:: s6200.h3.modhost.pro/katalog/tovar1.html

2.5.8 beta (01.06.2018)

  • Improved compatibility with "msmulticurrency"

2.5.7 beta (29.05.2018)

  • Change "loadControllerJsCss" [msoptionsprice]

2.5.6 beta (28.05.2018)

  • Change " msOptionsPrice.Product.action" [js]

2.5.5 beta (20.05.2018)

  • Change "setProductOptions","removeProductOptions" [msoptionsprice]

2.5.4 beta (15.05.2018)

  • Fix "uninstall" package

2.5.3 beta (11.05.2018)

  • Improved compatibility with "msmulticurrency"

2.5.2 beta (24.04.2018)

  • Change "saveProductModification" [msopModification]
  • Change "isWorkingClassKey, isWorkingTemplates, loadControllerJsCss" [msoptionsprice]

2.5.1 beta (23.04.2018)

  • Change "msOptionsPriceMsOnGetProductPrice,msOptionsPriceMsOnGetProductWeight,msOptionsPriceMsOnBeforeAddToCart" [msOptionsPricePlugin]
  • Add "msoptionsprice_mid" [js]

2.5.0 beta (16.04.2018)

  • Add "description" field [msopModification]
  • Add "description" [js]

2.4.14 beta (20.03.2018)

  • Add "msopOnManagerPrepareObjectData" event

2.4.13 beta (17.03.2018)

  • Fix "msopModification" [schema]

2.4.12 beta (02.03.2018)

  • Change "getModificationByImage" [msoptionsprice]
  • Add "escapedValue" [js]

2.4.11 beta (22.02.2018)

  • Change "prepareQueryOptions" [msoptionsprice]

2.4.8 - 2.4.10 beta beta (20.02.2018)

  • Change "getModificationByOptions" [msoptionsprice]

2.4.8 beta (19.02.2018)

  • Change "getModificationByOptions" [msoptionsprice]

2.4.7 beta (14.02.2017)

  • Change "fotorama" [js]

2.4.6 beta (12.12.2017)

  • Change "msopModificationCreateProcessor" processor
  • Change "msopModificationUpdateProcessor" processor
  • Change "msopModificationGetListProcessor" processor
  • Change "renderValues" [js]
  • Fix "processOptions" [js]

2.4.5 beta (05.12.2017)

  • Improved compatibility with "msBonus"

2.4.4 beta (04.12.2017)

  • Change "action" [js]

2.4.3 beta (16.11.2017)

  • Add "msopFilters"

2.4.1 beta (16.10.2017)

  • Add "name" field [js]

2.4.0 beta (29.09.2017)

  • Change "msopModificationCreateProcessor" processor
  • Change "msopModificationUpdateProcessor" processor

2.3.39 beta (15.09.2017)

  • Fix "msProductOptionGetKeysProcessor" processor

2.3.38 beta (14.09.2017)

  • Change "initialize,runProcessor" [msoptionsprice]

2.3.37 beta (13.09.2017)

  • Change "msProductOptionGetKeysProcessor" processor
  • Change "msopModificationOptionGetListProcessor" processor

2.3.36 beta (09.09.2017)

  • Change "msopModificationOptionGetListProcessor" processor

2.3.35 beta (09.09.2017)

  • Improved "getOptions" [msopModificationOption]

2.3.34 beta (07.09.2017)

  • Add "msOptionsPrice.Product.modification" [js]
  • Add "modification set" processor

2.3.33 beta (03.08.2017)

  • Improved "modification grid" [js]

2.3.32 beta (03.08.2017)

  • Improved "modification grid" [js]

2.3.31 beta (31.07.2017)

  • Fix "getModificationOptions" [msOptionsPrice.option]

2.3.30 beta (25.07.2017)

  • Add "showProductOptions" setting [msOptionsPrice.option]

2.3.29 beta (24.07.2017)

  • Remove "msOnCreateOrder" event
  • Add "status_pickup_remains" setting
  • Add "status_return_remains" setting

2.3.27-28 beta (30.06.2017)

  • Change "processOptions" [js]

2.3.26 beta (30.06.2017)

  • Fix "sort constraints" [msOptionsPrice.option]

2.3.25 beta (24.06.2017)

  • Add "version" [msOptionsPrice]
  • Fix "relations" [js]

2.3.24 beta (23.06.2017)

  • Add "processColors" [msOptionsPrice.option]

2.3.23 beta (22.06.2017)

  • Add "msOptionsPrice.Spinner" [js]
  • Add "submitDisabled, submitEnabled" to "msOptionsPrice.Product" [js]

2.3.22 beta (21.06.2017)

  • Add "window_modification_fields" setting

2.3.21 beta (18.06.2017)

  • Fix again "modification thumbs" [msProductFileGetListProcessor]

2.3.20 beta (17.06.2017)

  • Fix "modification thumbs" [msProductFileGetListProcessor]

2.3.19 beta (17.06.2017)

  • Add "showZeroCount" [msOptionsPrice.option]
  • Fix "setValue" [js]

2.3.18 beta (12.06.2017)

  • Improved "msopModificationOptionGetListProcessor"

2.3.17 beta (10.06.2017)

  • Improved "msProductOptionGetKeysProcessor"

2.3.16 beta (09.06.2017)

  • Fix "unique array" [js]

2.3.15 beta (09.06.2017)

  • Fix log "msOptionsPrice.modification" snippet

2.3.14 beta (02.06.2017)

  • Fix sort "msOptionsPrice.option" snippet

2.3.13 beta (01.06.2017)

  • Add "processOptions" [js]

2.3.12 beta (01.06.2017)

  • Improved "msOptionsPrice.option" snippet

2.3.11 beta (24.05.2017)

  • Set default "weight" [js]

2.3.9 beta (22.05.2017)

  • Fix "loadImages" [msopModification]
  • Improved "getModificationByImage" [msoptionsprice]

2.3.8 beta (22.05.2017)

  • Fix "loadImages" [msopModification]
  • Add "thumbs" [msOptionsPrice.modification]

2.3.7 beta (12.05.2017)

  • Fix "process options" in event

2.3.6 beta (06.05.2017)

  • Fix "sort" modification

2.3.5 beta (04.05.2017)

  • Fix "getkeys"

2.3.4 beta (02.05.2017)

  • Fix "getFirstImage" [msopModification]

2.3.3 beta (01.05.2017)

  • Add "msOptionsPrice.option" snippet

2.3.2 beta (29.04.2017)

  • Fix "getvalues"
  • Fix "loadImages"
  • Change "getModificationByOptions" for "empty options"

2.3.1 beta (24.04.2017)

  • Fix "getkeys"

2.3.0 beta (23.04.2017)

  • Add "include_modification_options" setting

2.2.39 beta (20.04.2017)

  • Improved [js]
  • Fix "prepareQueryOptions" [msOptionsPrice]

2.2.38 beta (04.04.2017)

  • Improved compatibility with "mFilter2" [js]

2.2.37 beta (26.03.2017)

  • Add "msopOnModificationBeforeSave", "msopOnModificationSave", "msopOnModificationBeforeRemove", "msopOnModificationRemove" event

2.2.36 beta (25.03.2017)

  • Move functional "msOptionsPrice.cart.remains" to "msOptionsPrice.initialize" snippet
  • Remove functional "msOptionsPrice.cart.remains" snippet
  • Improved "modification" remains

2.2.35 beta (24.03.2017)

  • Add "grid_modification_fields" setting

2.2.34 beta (24.03.2017)

  • Add "msOptionsPrice.cart.remains" snippet

2.2.33 beta (21.03.2017)

  • Add "en" lexicon

2.2.32 beta (20.03.2017)

  • Fix "setValue" [js]

2.2.31 beta (27.02.2017)

  • Add "processOptions" [msOptionsPrice.modification]

2.2.30 beta (24.02.2017)

  • Fix "initialize" [msOptionsPricePlugin]

2.2.29 beta (20.02.2017)

  • Add "modifications" to "product options"
  • Change "ms2_product_thumbnail_size" setting

2.2.28 beta (09.02.2017)

  • Fix compatibility with "mSearch2" [js]

2.2.27 beta (06.02.2017)

  • Empty "sync data" [dublicate]

2.2.26 beta (04.02.2017)

  • Add "loadOptions" fields [msopModification]

2.2.25 beta (04.02.2017)

  • Add "sync_id","sync_service" fields [msopModification]

2.2.24 beta (04.02.2017)

  • Improved "getModificationByOptions" [msopModification]

2.2.23 beta (02.02.2017)

  • Add "allow_zero_old_cost" setting
  • Add hide, show "old_cost" [js]

2.2.22 beta (01.02.2017)

  • Add "getOldCostByModification" [msopModification]
  • Add "old_price" field [msopModification]

2.2.20 beta (30.01.2017)

  • Fix "msopmodification.map" [msopModification]

2.2.19 beta (30.01.2017)

  • Fix "saveProductModification" [msopModification]

2.2.18 beta (26.01.2017)

  • Improved "saveProductModification" [msopModification]
  • Improved "removeProductModification" [msopModification]

2.2.17 beta (26.01.2017)

  • Add "removeProductModification" [msopModification]

2.2.15 beta (24.01.2017)

  • Change "saveProductModification" [msopModification]
  • Add "idx" [msOptionsPrice.modification]

2.2.14 beta (24.01.2017)

  • Change "get price" [msOptionsPrice.modification]
  • Add "excludeIds" ["msoptionsprice"]

2.2.13 beta (24.01.2017)

  • Add "prepareQueryOptions" ["msoptionsprice"]
  • Fix "set options" [js]

2.2.12 beta (23.01.2017)

  • Fix "fotorama" [js]
  • Fix "type modification" ["msoptionsprice"]
  • Fix "getModificationByImage" ["msoptionsprice"]
  • Fix "getModificationByOptions" ["msoptionsprice"]

2.2.11 beta (23.01.2017)

  • Add "exclude fieldNames, fieldClasess" [js]
  • Improved "msAddLinked" [js]

2.2.10 beta (23.01.2017)

  • Fix "load pdoFetch", "get price" [msOptionsPrice.modification]

2.2.9 beta (19.01.2017)

  • Fix "gallery" [minishop2]

2.2.8 beta (18.01.2017)

  • Fix round "old_cost"

2.2.7 beta (17.01.2017)

  • Add "duplicate action"

2.2.6 beta (17.01.2017)

  • Add "process old_cost"
  • Add "formatPrice", "formatWeight" [msOptionsPrice.modification]

2.2.5 beta (13.01.2017)

  • Fix "option getkeys"

2.2.4 beta (13.01.2017)

  • Fix "option getkeys"

2.2.3 beta (12.01.2017)

  • Add "allow_zero_modification" setting

2.2.2 beta (06.01.2017)

  • Improved compatibility with "UserFiles"

2.2.1 beta (05.01.2017)

  • Fix "qtip image" [js]
  • Add setting "modification_gallery_class"
  • Improved compatibility with "UserFiles"

2.2.0 beta (26.12.2016)

  • Add "sortby rank" [msoptionsprice]
  • Add "byOptions" [msOptionsPrice.modification]

2.1.25 beta - (23.12.2016)

  • Fix "change gallery image" [js]
  • Add "setGalleryImage,setValue" [js]

2.1.24 beta - (14.12.2016)

  • Add "allow_remains" setting
  • Improved "msOnBeforeAddToCart" event
  • Add "msOnBeforeChangeInCart", "msOnCreateOrder", "msOnChangeOrderStatus" event

2.1.23 beta - (09.12.2016)

  • Change "number_format" setting
  • Fix "getModificationByOptions sort" [msoptionsprice]
  • Fix "getModificationByImage sort" [msoptionsprice]
  • Improved "msoptionsprice"
  • Improved "modification get" processor

2.1.22 beta - (06.12.2016)

  • Improved "modification getlist" processor
  • Improved "product getimages" processor
  • Improved "gallery sort" processor
  • Improved "gallery update" processor

2.1.21 beta - (05.12.2016)

  • Add "allow_zero_article", "allow_zero_count" setting
  • Add "getFirstThumbnailId" method
  • Improved "getModificationById" method

2.1.20 beta - (02.12.2016)

  • Improved "msopModificationGetProcessor"

2.1.19 beta - (02.12.2016)

  • Add "msopOnGetModificationById", "msopOnModificationNotFound" event
  • Improved "msOptionsPriceMsOnGetProductPrice", "msOptionsPriceMsOnGetProductWeight"

2.1.18 beta - (02.12.2016)

  • Improved "saveProductModification"
  • Improved "getModificationById"

2.1.17 beta - (30.11.2016)

  • Add "name" modification

2.1.16 beta - (30.11.2016)

  • Add "msopOnGetFullCost", "msopOnGetFullMass" event

2.1.15 beta - (27.11.2016)

  • Fix "thumb rank" [msopModification]

2.1.14 beta - (23.11.2016)

  • Fix "fotorama" [js]

2.1.13 beta - (23.11.2016)

  • Fix "gallery" [minishop2]

2.1.12 beta - (23.11.2016)

  • Fix "not handle arrays options"

2.1.11 beta - (19.11.2016)

  • Add "sort_modification_option_values" setting
  • Add "prepareOptionValues" method

2.1.9-2.1.10 beta - (18.11.2016)

  • Add "window_modification_tabs" setting
  • Add "modification_thumbs" setting
  • Add "modification gallery"
  • Add "msOptionsPriceOnInit" plugin
  • Add "loadImages", "loadThumbs" methods
  • Add "images", "thumbs" to modification

2.1.8-beta - (14.11.2016)

  • Improved "saveProductModificationo"

2.1.7-beta - (08.10.2016)

  • Fix "radio" "default.js"

2.1.6-beta - (26.10.2016)

  • Fix "msOptionsPrice.modification" snippet
  • Fix "default.js"

2.1.5-beta - (18.10.2016)

  • Improved "msOptionsPrice.modification" snippet
  • Change "tpl.msOptionsPrice.modification" chunk
  • Add "msOnBeforeAddToCart" event

2.1.4-beta - (15.10.2016)

  • Improved "msOptionsPrice.modification" snippet

2.1.3-beta - (15.10.2016)

  • Fix "msOptionsPriceMsOnGetProductPrice", "msOptionsPriceMsOnGetProductWeight" return

2.1.2-beta - (14.10.2016)

  • Add "getProductModification"
  • Add "saveProductModification"
  • Add "create_modification_with_duplicate" setting
  • Add "number_format" setting
  • Add "OnResourceDuplicate", "OnEmptyTrash" plugin

2.1.1-beta - (11.10.2016)

  • Fix Notice

2.1.0-beta - (10.10.2016)

  • Add setting "search_modification_by_image_strict"
  • Improved "getModificationByImage"

2.0.20-beta - (06.10.2016)

  • Fix "formatPrice", "formatWeight"
  • Fix "get modification" by "image"
  • Add "getMassByModification"
  • Add "msopOnBeforeGetMass", "msopOnAfterGetMass"
  • Add "mass" to "default.js"

2.0.19-beta - (05.10.2016)

  • Add "getAlias"

2.0.18-beta - (05.10.2016)

  • Fix snippet "msOptionsPrice.modification"
  • Improved "getkeys.class.php"

2.0.17-beta - (03.10.2016)

  • Fix again "getvalues.class.php"
  • Change "minChars" combo "values"

2.0.16-beta - (03.10.2016)

  • Fix "getvalues.class.php"

2.0.15-beta - (02.10.2016)

  • Improved "getModificationByOptions"
  • Improved "get modification"
  • Change "options" on "msoptionsprice_options" in "product Data"

2.0.14-beta - (27.09.2016)

  • Add "formatOptionValue" in "default.js"

2.0.13-beta - (26.09.2016)

  • Fix "modification options" in "grid"

2.0.12-beta - (26.09.2016)

  • Improved "modification options"

2.0.11-beta - (26.09.2016)

  • Fix "set modification options"
  • Fix "sort modification options"
  • Fix "getModificationByOptions"
  • Add "msoptionsprice_product_action" event in "default.js"

2.0.10-beta - (15.09.2016)

  • Add "sort product options" on "add, remove"

2.0.9-beta - (13.09.2016)

  • Fix compatibility with "mSearch2"

2.0.8-beta - (13.09.2016)

  • Removed "value" from "exclude_modification_options"

2.0.7-beta - (11.09.2016)

  • Improved "modification panel"
  • Improved "modification options"

2.0.6-beta - (08.09.2016)

  • Fix "get modification" in "plugin"

2.0.5-beta - (08.09.2016)

  • Improved "search modification"
  • Add setting "search_modification_strict"

2.0.4-beta - (07.09.2016)

  • Fix "default.js"

2.0.3-beta - (07.09.2016)

  • Add setting "exclude_modification_options"

2.0.2-beta - (06.09.2016)

  • Improved compatibility with "mSearch2"

2.0.1-beta - (06.09.2016)

  • Add "modification image"

2.0.0-beta

  • Initial

1.1.4-beta (19.06.2016)

  • Compatibility with "miniShop2 2.4.0"

1.1.2-beta

  • Add msOptionsPrice2ManagerPolicy

1.1.1-beta

  • Fix name package

1.1.0-beta

  • Added new events: "msop2OnBeforeProductGetPrice" "msop2OnProductGetPrice" "msop2OnBeforeProductGetWeight" "msop2OnProductGetWeight" "msop2OnBeforeProductGetArticle" "msop2OnProductGetArticle"

1.0.9-beta (17.09.2015)

  • fix show article in grid

1.0.8-beta (31.08.2015)

  • fix get article

1.0.7-beta (04.07.2015)

  • add option field to create all price.

1.0.5-beta (21.04.2015)

  • add weight of the goods.

1.0.4-beta (19.04.2015)

  • add compatibility with msBatchEditor

1.0.3-beta (17.04.2015)

  • add compatibility with msDiscount

1.0.2-beta (01.04.2015)

  • bug fixes

1.0.1-beta (16.03.2015)

  • add remains of the goods.
  • add options snippet.