Jump to content

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

Show Vendor Store Link Only If They Have A Plan That Allows It? Rate Topic   - - - - -

 

Posted 31 March 2019 - 08:37 AM #1

How can one show a link to a vendor store only if that vendor has a plan that allows vendors to have a store..? thanks

 

for example:

 

{if !$vendor store = 'Y'}

<a href="vendor url">vendor name</a>

{/if}



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 606 posts

Posted 31 March 2019 - 10:32 AM #2

Hello

 

First, you need to check what the vendor's plan is
$plan_id = db_get_field("SELECT plan_id FROM ?:companies WHERE company_id = ?i", $company_id);
 
Next, you need to check whether the checkbox vendor_store is checked in the plan.
$vendor_store = db_get_field("SELECT vendor_store FROM ?:vendor_plans WHERE plan_id = ?i", $plan_id);

 

And then you can use your condition.

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

 

Posted 31 March 2019 - 11:16 AM #3

Thanks for the quick response i will implement this and let you know, do you know if this kind of approach will work if a user add product in wishlist to hide the wishlist button and cart too..



 
  • imago
  • Senior Member
  • Members
  • Join Date: 18-Oct 18
  • 447 posts

Posted 31 March 2019 - 11:58 AM #4

How can one show a link to a vendor store only if that vendor has a plan that allows vendors to have a store..? thanks

 

I use an add-on to show all vendor groups along with the customer and administrator groups, allowing to create specific blocks for each group.



 

Posted 31 March 2019 - 12:04 PM #5

Hello

 

First, you need to check what the vendor's plan is
$plan_id = db_get_field("SELECT plan_id FROM ?:companies WHERE company_id = ?i", $company_id);
 
Next, you need to check whether the checkbox vendor_store is checked in the plan.
$vendor_store = db_get_field("SELECT vendor_store FROM ?:vendor_plans WHERE plan_id = ?i", $plan_id);

 

And then you can use your condition.

 

Best regards

Robert

I did this but it didn't work, can you explain how i should add the code and the condition?

Thanks



 

Posted 31 March 2019 - 12:06 PM #6

I use an add-on to show all vendor groups along with the customer and administrator groups, allowing to create specific blocks for each group.

 

H5B02C.jpg

 

 

Thanks for the response, but what i want to achieve i to hide the store link on the product page if the vendor doesn't have a store.



 
  • imago
  • Senior Member
  • Members
  • Join Date: 18-Oct 18
  • 447 posts

Posted 31 March 2019 - 12:10 PM #7

Thanks for the response, but what i want to achieve i to hide the store link on the product page if the vendor doesn't have a store.

 

This is precisely the action of this addon. It shows the block with the link to vendor.php only to registered members who happen to be Gold Vendor, Silver Vendor, etc. - see what is checked/ticked.

 

H5B02C.jpg



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 606 posts

Posted 31 March 2019 - 04:18 PM #8

Hello

 

 

I did this but it didn't work, can you explain how i should add the code and the condition?

Thanks

 

You must prepare function e.g. in my_changes and reference it in the template.

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

 

Posted 31 March 2019 - 07:22 PM #9

I tried to assign with smarty function still didn't work for individual vendors
 
<?php
function smarty_function_seller_store($params, &$smarty) {
$vendor_store = db_get_field("SELECT vendor_store FROM ?:vendor_plans WHERE plan_id = ?i", $plan_id);
if( empty($vendor_store) ) {
$smarty->assign('is_store', false);
} else {
$smarty->assign('is_store', true);
}
}


 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 606 posts

Posted 31 March 2019 - 07:58 PM #10

Hello

 

How do I understand you want to do this on the home page?
You must have access to the company_id, i.e. to the vendor id.
next:
 
{assign var = "vendor_store" value = $company_id|smarty_function_seller_store}
(Above you must substitute the appropriate variable that contains the company_id)
 
function smarty_function_seller_store ($company_id) {
  $plan_id = db_get_field ("SELECT plan_id FROM ?:companies WHERE company_id = ?i", $company_id);
  $vendor_store = db_get_field ("SELECT vendor_store FROM?: vendor_plans WHERE plan_id = ?i", $plan_id);
  return $ vendor_store;
}
 
In template
{if! $vendor store}
<a href="vendor url"> vendor name </a>
{/if}

Team of SoftSolid
cs-cart.pl