Приставка Цены Для Товара С Вариациями


#1

Привет!

Хочу чтобы в каталоге товаров, для товара у которого есть вариации (именно вариации) перед ценой стояла приставка "от". Подскажите, в какую сторону копать?

1.png


#2

Смотрите шаблон design/themes/[ТЕМА]/templates/common/product_data.tpl (используйте хук products:prices_block). Например, можно проверять есть ли в массиве значение $product.variation_options и добавлять текст, если условие выполняется.


#3

Подскажите еще как вывести стоимость вариации в карточке товара рядом с самой вариацией? Точно как это реализовано в опциях, но только стоимость, а не модификатор цены.


#4

Смотрите шаблон design/themes/[ТЕМА]/templates/common/product_data.tpl (используйте хук products:prices_block). Например, можно проверять есть ли в массиве значение $product.variation_options и добавлять текст, если условие выполняется.

сделал так

{if $product.variation_options}
от
{/if}

но приставка "от" добавляется ко всем настраиваемым товарам. Как сделать, чтобы добавлялась только если есть две вариации и больше?


#5

Попробуйте так

{if $product.variation_options|count > 1}
от
{/if}

#6

Попробуйте так

{if $product.variation_options|count > 1}
от
{/if}

не работает - {$product.variation_options|count} для всех настраиваемых товаров с любым кол-вом вариаций выводит цифру 1


#7

не работает - {$product.variation_options|count} для всех настраиваемых товаров с любым кол-вом вариаций выводит цифру 1

Распечатайте $product, посмотрите, что там по вариациям есть

{$product|fn_print_r}

#8

Совсем забыл про этот код.

Array
(
    [product_id] => 621
    [product] => Полотенцесушители Mario Стандарт
    [instock_marker] => 1
    [instock_sorting] => 1
    [popularity] => 112
    [sales_amount] => 
    [product_code] => 1.1.0202.01.P
    [product_type] => C
    [status] => A
    [company_id] => 1
    [list_price] => 2005
    [amount] => 1
    [weight] => 0.000
    [length] => 0
    [width] => 0
    [height] => 0
    [shipping_freight] => 0.00
    [low_avail_limit] => 0
    [timestamp] => 1500635969
    [updated_timestamp] => 1502094844
    [usergroup_ids] => 0
    [is_edp] => N
    [edp_shipping] => N
    [unlimited_download] => N
    [tracking] => B
    [free_shipping] => Y
    [zero_price_action] => R
    [is_pbp] => N
    [is_op] => N
    [is_oper] => N
    [is_returnable] => Y
    [return_period] => 10
    [avail_since] => 0
    [out_of_stock_actions] => N
    [localization] => 
    [min_qty] => 0
    [max_qty] => 0
    [qty_step] => 0
    [list_qty_count] => 0
    [tax_ids] => 
    [age_verification] => N
    [age_limit] => 0
    [options_type] => P
    [exceptions_type] => F
    [details_layout] => default
    [shipping_params] => a:5:{s:16:"min_items_in_box";i:0;s:16:"max_items_in_box";i:0;s:10:"box_length";i:0;s:9:"box_width";i:0;s:10:"box_height";i:0;}
    [my_opt_price] => 0.00
    [my_opt_price_modif] => 0.000
    [my_opt_price_modif_type] => A
    [my_opt_price_cur] => UAH
    [external_id] => 
    [parent] => N
    [facebook_obj_type] => 
    [parent_product_id] => 0
    [variation_code] => 
    [variation_options] => [577]
    [price] => 2005
    [short_description] => 
    [full_description] => 

Изготовлен из нержавеющей стали АІSI 304 может быть оборудован электрическим теном с любой стороны.

[meta_keywords] => [meta_description] => [search_words] => [promo_text] => [category_ids] => Array ( [0] => 254 )
[position] => 0
[seo_name] => polotencesushitel-mario-standart
[seo_path] => 254
[average_rating] => 
[discussion_type] => B
[discussion_thread_id] => 780
[main_category] => 254
[selected_options] => Array
    (
        [577] => 2792
    )

[product_options] => Array
    (
        [577] => Array
            (
                [option_id] => 577
                [product_id] => 621
                [company_id] => 1
                [option_type] => R
                [inventory] => N
                [regexp] => 
                [required] => Y
                [multiupload] => N
                [allowed_extensions] => 
                [max_file_size] => 0
                [missing_variants_handling] => M
                [status] => A
                [position] => 0
                [value] => 2792
                [external_id] => 
                [option_name] => Размер (ВхШ), мм
                [option_text] => 
                [description] => 
                [inner_hint] => 
                [incorrect_message] => 
                [comment] => 
                [variants] => Array
                    (
                        [2792] => Array
                            (
                                [variant_id] => 2792
                                [option_id] => 577
                                [position] => 0
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 600х430/400
                                [image_pair] => Array
                                    (
                                    )

                            )

                        [2793] => Array
                            (
                                [variant_id] => 2793
                                [option_id] => 577
                                [position] => 1
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 600х530/500
                                [image_pair] => Array
                                    (
                                    )

                            )

                        [2794] => Array
                            (
                                [variant_id] => 2794
                                [option_id] => 577
                                [position] => 2
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 700х430/400
                                [image_pair] => Array
                                    (
                                    )

                            )

                        [2795] => Array
                            (
                                [variant_id] => 2795
                                [option_id] => 577
                                [position] => 3
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 700х530/500
                                [image_pair] => Array
                                    (
                                    )

                            )

                        [2796] => Array
                            (
                                [variant_id] => 2796
                                [option_id] => 577
                                [position] => 4
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 800х530/500
                                [image_pair] => Array
                                    (
                                    )

                            )

                        [2797] => Array
                            (
                                [variant_id] => 2797
                                [option_id] => 577
                                [position] => 5
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 900х530/500
                                [image_pair] => Array
                                    (
                                    )

                            )

                        [2798] => Array
                            (
                                [variant_id] => 2798
                                [option_id] => 577
                                [position] => 6
                                [modifier] => 0.000
                                [modifier_type] => A
                                [weight_modifier] => 0.000
                                [weight_modifier_type] => A
                                [variant_name] => 1200х530/500
                                [image_pair] => Array
                                    (
                                    )

                            )

                    )

            )

    )

[has_options] => 
[selected_variation_code] => 621_2792
[variation_product_id] => 622
[options_update] => 7
[main_pair] => Array
    (
        [pair_id] => 4029
        [image_id] => 0
        [detailed_id] => 4051
        [position] => 0
        [detailed] => Array
            (
                [object_id] => 622
                [object_type] => product
                [image_path] => /images/watermarked/1/detailed/4/standart-600x400-1.jpg
                [alt] => Полотенцесушители Mario Стандарт
                [image_x] => 990
                [image_y] => 1326
                [http_image_path] => /images/watermarked/1/detailed/4/standart-600x400-1.jpg
                [https_image_path] => /images/detailed/4/standart-600x400-1.jpg
                [absolute_path] => //public_html/images/watermarked/1/detailed/4/standart-600x400-1.jpg
                [relative_path] => detailed/4/standart-600x400-1.jpg
            )

    )

[base_price] => 2005.000000
[inventory_amount] => 1
[image_pairs] => Array
    (
        [4030] => Array
            (
                [pair_id] => 4030
                [image_id] => 0
                [detailed_id] => 4052
                [position] => 0
                [detailed] => Array
                    (
                        [object_id] => 622
                        [object_type] => product
                        [image_path] => /images/watermarked/1/detailed/4/standart-600x400-2.jpg
                        [alt] => Полотенцесушители Mario Стандарт
                        [image_x] => 1200
                        [image_y] => 1011
                        [http_image_path] => /images/watermarked/1/detailed/4/standart-600x400-2.jpg
                        [https_image_path] => /images/detailed/4/standart-600x400-2.jpg
                        [absolute_path] => /public_html/images/watermarked/1/detailed/4/standart-600x400-2.jpg
                        [relative_path] => detailed/4/standart-600x400-2.jpg
                    )

            )

    )

[base_modifier] => 2005
[original_price] => 2005
[modifiers_price] => 0
[discounts] => Array
    (
        [A] => 0
        [P] => 0
    )

[qty_content] => Array
    (
    )

[detailed_params] => Array
    (
        [get_icon] => 1
        [get_detailed] => 1
        [get_additional] => 1
        [get_options] => 1
        [get_discounts] => 1
        [get_features] => 
        [get_extra] => 
        [get_taxed_prices] => 1
        [get_for_one_product] => 
        [detailed_params] => 1
        [features_display_on] => C
    )

[for_discount] => D
[product_features] => Array
(
[0] => Array
(
[feature_id] => 82
[value] =>
[value_int] =>
[variant_id] => 6494
[feature_type] => M
[description] => Ширина (габарит), мм
[prefix] =>
[suffix] =>
[variant] => 430
[parent_id] => 47
[features_hash] => 35-6495
[variants] => Array
(
[6494] => Array
(
[value] =>
[value_int] =>
[variant_id] => 6494
[variant] => 430
[image_pairs] =>
)

                        [6495] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 6495
                                [variant] => 530
                            )

                    )

            )

        [1] => Array
            (
                [feature_id] => 19
                [value] => 
                [value_int] => 
                [variant_id] => 146
                [feature_type] => M
                [description] => Высота, мм
                [prefix] => 
                [suffix] => 
                [variant] => 600
                [parent_id] => 47
                [features_hash] => 11-163
                [variants] => Array
                    (
                        [146] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 146
                                [variant] => 600
                                [image_pairs] => 
                            )

                        [147] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 147
                                [variant] => 700
                            )

                        [148] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 148
                                [variant] => 800
                            )

                        [149] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 149
                                [variant] => 900
                            )

                        [163] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 163
                                [variant] => 1200
                            )

                    )

            )

        [2] => Array
            (
                [feature_id] => 20
                [value] => 
                [value_int] => 
                [variant_id] => 164
                [feature_type] => M
                [description] => Межцентровое растояние, мм
                [prefix] => 
                [suffix] => 
                [variant] => 400
                [parent_id] => 47
                [features_hash] => 12-145
                [variants] => Array
                    (
                        [164] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 164
                                [variant] => 400
                                [image_pairs] => 
                            )

                        [145] => Array
                            (
                                [value] => 
                                [value_int] => 
                                [variant_id] => 145
                                [variant] => 500
                            )

                    )

            )

        [3] => Array
            (
                [feature_id] => 21
                [value] => 
                [value_int] => 170.00
                [variant_id] => 6357
                [feature_type] => N
                [description] => Глубина, мм
                [prefix] => 
                [suffix] => 
                [variant] => 170
                [parent_id] => 47
                [variants] => Array
                    (
                        [6357] => Array
                            (
                                [value] => 
                                [value_int] => 170.00
                                [variant_id] => 6357
                                [variant] => 170
                                [image_pairs] => 
                            )

                    )

            )

        [4] => Array
            (
                [feature_id] => 67
                [value] => 
                [value_int] => 155.00
                [variant_id] => 0
                [feature_type] => O
                [description] => Теплоотдача при 65°С
                [prefix] => 
                [suffix] =>  Вт
                [variant] => 
                [parent_id] => 47
            )

    )

)


#9

Получилось, но только так. Думаю это не совсем правильный вариант, т.к. подсчитываются опции, а не вариации

{if $product.variation_options}
    {if $product.options_update}
        от
    {/if}
{/if}

#10

Получилось, но только так. Думаю это не совсем правильный вариант, т.к. подсчитываются опции, а не вариации

{if $product.variation_options}
    {if $product.options_update}
        от
    {/if}
{/if}

Да, что-то нет нужной информации в массиве. Тогда дорабатывать надо, если текущий вариант не подходит