Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Create A New Action For Cscart Admin

 
  • ugo
  • Newbie
  • Trial users
  • Join Date: 02-Feb 21
  • 11 posts

Posted 18 March 2021 - 04:42 PM #1

Under the orders section I need to create a new action that would take all selected addons and find the optimal route. I have sign up with companies for the relevant api's. How can I add a new action to the admin panel. The advanced addon guide doesnt really show how to get the addon to show there.

 

 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21708 posts

Posted 19 March 2021 - 05:44 AM #2

You can use hook from Quickbooks addon as example

 

design/backend/templates/addons/quickbooks/hooks/orders/export_tools_list_for_selected.post.tpl


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • ugo
  • Newbie
  • Trial users
  • Join Date: 02-Feb 21
  • 11 posts

Posted 19 March 2021 - 09:44 AM #3

Thank for the reply I tried doing as you suggested and created an actions.post.tpl file in this location 

/var/www/html/cart/design/backend/templates/addons/pnp_routes_optimizer/hooks/orders

I then populated actions.post.tpl with this code

<li>
    {btn type="list"
         text={__("view_purchased_products")}
         dispatch="dispatch[orders.products_range]"
         form="orders_list_form"}
</li>
{hook name="orders:view_tools_list_for_selected"}
{/hook}

My expected result is that under Orders when multiple items are selected there are now 4 items available as actions but I still get the default 3 actions and my newly created one doesnt show up. Any ideas where I went wrong ?  



 
  • ugo
  • Newbie
  • Trial users
  • Join Date: 02-Feb 21
  • 11 posts

Posted 19 March 2021 - 10:33 AM #4

 

Thank for the reply I tried doing as you suggested and created an actions.post.tpl file in this location 

/var/www/html/cart/design/backend/templates/addons/pnp_routes_optimizer/hooks/orders

I then populated actions.post.tpl with this code

<li>
    {btn type="list"
         text={__("view_purchased_products")}
         dispatch="dispatch[orders.products_range]"
         form="orders_list_form"}
</li>
{hook name="orders:view_tools_list_for_selected"}
{/hook}

My expected result is that under Orders when multiple items are selected there are now 4 items available as actions but I still get the default 3 actions and my newly created one doesnt show up. Any ideas where I went wrong ?  

 

 

Turns out I had to name it as export_tools_list_for_selected.post.tpl or it wouldnt show up. Anyone know why it needs this name for it to work.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21708 posts

Posted 19 March 2021 - 02:21 PM #5

You should use the export_tools_list_for_selected hook to add new action so the file should be named accordingly


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)