Consolidation of code tips

Links to code fixes previously provided that can be used as is or a hint for other fixes, I will add to it as I come across more.

Please note that most of these aren’t my solutions, if they work for you show some love to solution provider in the relevant post (this helps with their forum status and is common courtesy).

conditionally display order details in vendor panel
add a field/column to an existing list
add images to product via API
enable lazy image loading
change time stamp format
display custom vairables - the DODGY way
remove print invoice options from orders? Note: must have ecom Full CKEditor add-on installed.
delete the old HTML block with Smarty support block type
Api Authentication For Customers?
turn gallery on/off in standard theme
add quantity discounts to all variants within a product
change vendor onboarding link in vendor panel
prevent DDOS targeting number of items displayed
mobile API endpoint
line breaks in import file … not quiet following my template here, thought it was useful, see the diff file.
Tick tax box by default
Update heading e.g. product name on page template
sort shipping rate areas by ascending weights

add google tags
add Custom CSS
add code between header tags 2nd post down, it works, ignore other posts
leave the “My billing address is different from the shipping address”checkbox unchecked by default
Update field label at checkout
[How to add new admin page] (How To Add a New Page on Admin Panel)

add custom CSS using my_changes add-on
change LINK SIZE in Blog
change the TAG CLOUD different font SIZE & COLOR
make ADMIN PANEL backend FULL Width

Product main image: Settings → Thumbnails → Product details page thumbnail width
resize blog images
resize vendor logo on product page
resize logo

Shipping info {{order_info.shipping.0.shipping}}
Display profile fields related topic = related
Linking to feature pages
vendor link to blogs
link to a product
display promotions in smarty block
Company details - email vairables
Vendor admin data see 27 Apr 2024

Template tweaks
Product Grid, display out of stock

In documents / Email Templates

In Blocks
Quantity available {$product.amount}

Operating Hours:
{(‘weekday_abr_1’)}-{(‘weekday_abr_0’)} 9.00 - 18.00


State: {$settings.Company.company_state|fn_get_state_name:$settings.Company.company_country}


I don’t know if this counts as a code tip, but we use it from time to time.

If you want to disable ajax when changing order statuses (so that printing inside functions responsible for order status changes works), do the following changes in code.

In file /design/backend/templates/common/select_popup.tpl in line:

                            <li {if $status == $st}class="disabled"{/if}><a class="{if $confirm}cm-confirm {/if}status-link-{$st|lower} {if $status == $st}active{else}cm-ajax cm-post{if $ajax_full_render} cm-ajax-full-render{/if}{/if} {if $status_meta}{$status_meta}{/if}"{if $status_target_id} data-ca-target-id="{$status_target_id}"{/if} href="{"`$_update_controller`.update_status?id=`$id`&status=`$st``$extra_params``$dynamic_object`"|fn_url}" onclick="return fn_check_object_status(this, '{$st|lower}', '{if $statuses}{$statuses[$st].params.color|default:''}{/if}');" {if $st_result_ids}data-ca-target-id="{$st_result_ids}"{/if} data-ca-event="ce.update_object_status_callback">{$val}</a></li>

remove the parameter cm-ajax,
and from the line:

div class=“cm-popup-box dropleft {if !$hide_for_vendor}dropdown{/if} {$popup_additional_class}”

remove the parameter cm-popup-box.

Note this this has some consequences, for example it causes e-mail notifications to not send, so it’s something that should be used only in development environment.

This isn’t cs-cart specific and is general utility so posting in a seperate box.

Utilitiy code
Upsize small images upto 100px minimum