Jump to content

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

Check for Vendor in Backend .tpl files Rate Topic   * * * * * 1 votes

 
  • philspeak
  • Member
  • Members
  • Join Date: 09-Sep 13
  • 32 posts

Posted 29 October 2013 - 03:36 AM #1

Hi,

I'm trying to find a way to check for vendor page in the backend.

I.e. how to tell if the user is in admin backend or vendor backend?

Any help would be much appeciated

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

Posted 29 October 2013 - 03:50 AM #2

What version are you running? In V3, you would simply use (php)
if( defined("COMPANY_ID") )
In template code you would just use
{if $smarty.const.COMPANY_ID}
Not sure about MVE in V4 (haven't looked). But for all versions you could probably do:
if( strpos("vendor.php", $_SERVER['REQUEST_URI']) ) // php code
{if "vendor.php"|strpos:$smarty.server.REQUEST_URI}  {* tpl syntax *}

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.


 
  • philspeak
  • Member
  • Members
  • Join Date: 09-Sep 13
  • 32 posts

Posted 30 October 2013 - 02:19 AM #3

Cheers @tbirnseth you led me onto the right path. I actually used the following code:

<div>{if $smarty.server.REQUEST_URI|strstr:"vendor.php"}&nbsp;</div><div>&nbsp; &nbsp; VENDOR</div><div>{else}</div><div>&nbsp; &nbsp; ADMIN</div><div>{/if}</div>

* Edited for readability:

{if $smarty.server.REQUEST_URI|strstr:"vendor.php"}
MULTIVENDOR
{else}
ADMIN
{/if}

Edited by philspeak, 30 October 2013 - 02:20 AM.


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

Posted 30 October 2013 - 02:24 AM #4

While that works, it does make you dependent upon a name that can be changed in config.local.php for MVE which is not good. To be robust, you should change "vendor.php" to use $config.vendor_index.

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.


 
  • philspeak
  • Member
  • Members
  • Join Date: 09-Sep 13
  • 32 posts

Posted 30 October 2013 - 04:10 AM #5

cheers @tbirnseth ... have taken on your suggestion :)