Jump to content

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

Can I Get Company Id On Function/smarty From Database? Rate Topic   - - - - -

 
  • Dexterflamez
  • Senior Member
  • Trial users
  • Join Date: 08-Jan 18
  • 312 posts

Posted 22 December 2020 - 04:52 PM #1

$company_id = db_get_field("SELECT company_id FROM ?:company WHERE company_id = ?i" 
 
something like this getting the company id from database?


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

Posted 23 December 2020 - 06:27 AM #2

If you mean multi-storefront, please use $runtime.company_id variable in Smarty template


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)

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

Posted 23 December 2020 - 10:13 PM #3

Won't work if running single storefront that's been upgraded from years past....  Not sure about new stores.  Use

{""|fn_get_runtime_company_id}

instead. 

 

Old conversion hacks in early 4.x where they did not migrate company_id = 0 to company_id = 1 for single site installations.  Here's the logic used:

function fn_get_runtime_company_id()
{
    $company_id = Registry::ifGet('runtime.company_id', 0);
    if (!$company_id && Registry::get('runtime.simple_ultimate')) {
        $company_id = Registry::get('runtime.forced_company_id');
    }
 
    return $company_id;
}

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
  • 21980 posts

Posted 24 December 2020 - 06:57 AM #4

Thanks for the clarification


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)

 
  • Dexterflamez
  • Senior Member
  • Trial users
  • Join Date: 08-Jan 18
  • 312 posts

Posted 27 December 2020 - 08:30 AM #5

Thanks guys, i appreciate the help