Jump to content

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

Theme Modifications Rate Topic   - - - - -

 
  • madanps
  • Newbie
  • Trial users
  • Join Date: 23-Jun 21
  • 11 posts

Posted 05 July 2021 - 06:45 AM #1

I wish to modify a behaviour from products page. When clicking on vendor name, to redirect to external domain. Till now I have understood that, if the file contains {hook}{/hook}, I can modify the behaviour by adding a separate hook file (pre,post,override).

 

I am working on a custom theme, and the file, where I want modifications, doesn't have hooks in it. So, the modification that I expect, I have to manually code,

-> first by adding {hook}...

-> then creating a (post,pre,override) file.

 

 

Problem that I might run into is, if the theme will have upgrades in future, my custom codes/modifications will be lost.

 

So, my question is what is the best approach to work on modifications?

 



 
  • madanps
  • Newbie
  • Trial users
  • Join Date: 23-Jun 21
  • 11 posts

Posted 05 July 2021 - 06:50 AM #2

I want to follow the approach of creating a separate addon and don't modify the files that exists in the theme, and no matter for upgrades, my changes will reflect, but this way, I can't seem to find a way, how to do it.
Please suggest me



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

Posted 05 July 2021 - 01:24 PM #3

If you mean redirect from the vendor page, you can catch this request in the companies.pre.php controller in your addon


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)

 
  • madanps
  • Newbie
  • Trial users
  • Join Date: 23-Jun 21
  • 11 posts

Posted 05 July 2021 - 02:17 PM #4

If you mean redirect from the vendor page, you can catch this request in the companies.pre.php controller in your addon

From vendor page is just an example. In fact, I have multiple places from where, I have to redirect to external domain for every vendors. I needed a better understanding of how to apply modifications in themes, because after theme upgrades, my custom changes would be lost.

Can you please share about how can I make modifications such that the changes would remain even after theme upgrade.


From vendor page is just an example. In fact, I have multiple places from where, I have to redirect to external domain for every vendors. I needed a better understanding of how to apply modifications in themes, because after theme upgrades, my custom changes would be lost.

Can you please share about how can I make modifications such that the changes would remain even after theme upgrade.

To be specific, I am working on vivashop theme.



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

Posted 06 July 2021 - 05:04 AM #5

You can find find useful information about templates here

 

https://docs.cs-cart.../tpl_hooks.html


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)

 
  • madanps
  • Newbie
  • Trial users
  • Join Date: 23-Jun 21
  • 11 posts

Posted 16 July 2021 - 03:03 PM #6

If you mean redirect from the vendor page, you can catch this request in the companies.pre.php controller in your addon

I tried to catch request from

companies.view?company_id=`$company_id`

 

in companies.pre.php, at mode=view.

 

-> but, everytime, the link redirects to "companies.products", and I have to match it's SEO name to match and open vendor link.

 

->  another problem i am facing is, i can't figure out a way to open the link in new tab.

 

currently, my code is as:

 

$company_id = (int) $_REQUEST['company_id'];

$company_data = !empty($company_id) ? fn_get_company_data($company_id) : [];

header("HTTP/1.1 301 Moved Permanently");

header("Location: " . $company_data['url']);

exit();

 

can you help me to oepn the url in new tab please.



 
  • madanps
  • Newbie
  • Trial users
  • Join Date: 23-Jun 21
  • 11 posts

Posted 16 July 2021 - 03:07 PM #7

I am not allowed to modify the existing theme, so I am trying to make changes by creating a custom addon



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12091 posts

Posted 18 July 2021 - 06:52 PM #8

You should use either the my_changes addon or create a new one.

If there are no hooks in the theme file from Vivashop, you can either:

  1 - ask them to add the hook so it will appear in future releases of theirs

  2 - Use an override.  Copy the file to the override location in your addon and edit away


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


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

Posted 19 July 2021 - 05:39 AM #9

can you help me to oepn the url in new tab please.

 

New tab can be opened with few lines of javascript in controller


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)

 
  • madanps
  • Newbie
  • Trial users
  • Join Date: 23-Jun 21
  • 11 posts

Posted 20 July 2021 - 03:25 PM #10

You should use either the my_changes addon or create a new one.

If there are no hooks in the theme file from Vivashop, you can either:

  1 - ask them to add the hook so it will appear in future releases of theirs

  2 - Use an override.  Copy the file to the override location in your addon and edit away

i needed only to customize a selected div and not the whole file.
is it possible if there is no hooks attatched?



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12091 posts

Posted 20 July 2021 - 06:33 PM #11

i needed only to customize a selected div and not the whole file.
is it possible if there is no hooks attatched?

 

No.  Suggest you contact the theme vendor to ask if they will add it to their standard product or you can add it yourself and then be cognizant when you upgrade the theme to a newer version.  Obviously best to have the vendor adopt your requested change.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.