Tax Check Box Ticked By Default

HI

In admin when setting up a product I would like the tax check box to be ticked by default. What file do I need to modify.

Alan

You can change the database default value if you only have one tax_id.

ALTER TABLE `cscart_products` CHANGE `tax_ids` `tax_ids` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'change_to_your_tax_id';

You can change the database default value if you only have one tax_id.

ALTER TABLE `cscart_products` CHANGE `tax_ids` `tax_ids` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'change_to_your_tax_id';

Thanks

Sorry, I should have mentioned that this is a multi store setup and I do have more than one tax id.

So not sure that would work.

I'm not familiar with the DB structure for multi store so I don't know if it's possible or not.

Try this:

/design/backend/templates/views/products/update.tpl

Replace:



With:


            

Try this:

/design/backend/templates/views/products/update.tpl

Replace:



With:


HI

Thanks for that, Unfortunately it didn't work.

Alan

The provided solution should work. Try to clear cache

The provided solution should work. Try to clear cache

Thanks EcomLabs, But I have tried everything, including deleting the backend cache via ftp and it still does not work.

Regards

Alan

PM me temporary FTP access, we will check

PM me temporary FTP access, we will check

Did you ever get to fix this please? I am running 4.7.1 and cant get it to woprk, even though the changes have been made.

Thanks in advance!!!

Did you ever get to fix this please? I am running 4.7.1 and cant get it to woprk, even though the changes have been made.

Thanks in advance!!!

No, we did not examine the issue

We need the New Product Tax box checked by default, because staff forget to tick it.

In V4.3.5 we made it work by edititing /design/backend/templates/views/products/update.tpl

And replacing
<input type=“checkbox” name=“product_data[tax_ids][{$tax.tax_id}]” id=“elm_taxes_{$tax.tax_id}” {if $tax.tax_id|in_array:$product_data.tax_ids}checked=“checked”{/if} value=“{$tax.tax_id}” />

With
<input type=“checkbox” name=“product_data[tax_ids][{$tax.tax_id}]” id=“elm_taxes_{$tax.tax_id}” {if $tax.tax_id|in_array:$product_data.tax_ids || $runtime.mode == ‘add’}checked=“checked”{/if} value=“{$tax.tax_id}” />

But now with V4.16.2 the file shows

                   {hook name="products:update_product_tax_ids"}
                        {component name="configurable_page.field" entity="products" tab="detailed" section="pricing_inventory" field="tax_ids"}
                            <div class="control-group">
                                <label class="control-label">{__("taxes")}:</label>
                                <div class="controls">
                                    <input type="hidden" name="product_data[tax_ids]" value="" />
                                    {include file="common/adaptive_object_selection.tpl"
                                        input_name="product_data[tax_ids]"
                                        input_id="elm_taxes"
                                        item_ids=$product_data.tax_ids
                                        items=$taxes
                                        id_field="tax_id"
                                        name_field="tax"
                                        type="taxes"
                                        class_prefix="taxes"
                                        close_on_select="false"
                                        list_mode=false
                                    }

Now I’m lost what to change. Can someone point me in the right direction?

Thanks.

Try to add before {include} the following code

{if $runtime.mode == 'add'}
  {$product_data.tax_ids = []}
  {foreach from=$taxes item=t}
    {$product_data.tax_ids[] = $t.tax_id}
  {/foreach}
{/if}

(!) Not tested

1 Like

It works perfectly!

Thank you so much!

1 Like

I know this task has already been resolved - but if you’re looking for a ready-made addon solution for default taxes, we have one available in Marketplace :slight_smile:

2 Likes

That’s a good solution for those who don’t want to/can’t change code.

And very good value!