Jump to content

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

Deactive Guest Checkout For Certain Products Only Rate Topic   - - - - -

 
  • simenkl
  • Member
  • Members
  • Join Date: 27-Feb 14
  • 36 posts

Posted 24 December 2014 - 10:51 AM #1

Hi!

I would like to deactivate checkout as guest for two products in the catalog only and allow guest checkout for the remaining products. In other words, if one of the two products are in the cart, the user have to register on checkout. If they are not they can choose to checkout as guests.

Has anyone done anything similiar before?

Thank you and merry christmas!

Simen

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

Posted 24 December 2014 - 11:14 AM #2

Please create the app\addons\my_changes\controllers\frontend\checkout.post.php file with the following content:

<?php
use Tygh\Registry;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
return;
}
$cart = $_SESSION['cart'];
if (!empty($cart) && !empty($cart['products'])) {
$allowed = true;
foreach ($cart['products'] as $p) {
  if ($p['product_code'] == '123' || $p['product_code'] == '456') {
   $allowed = false;
   break;
  }
}
Registry::set('settings.General.disable_anonymous_checkout', $allowed == true ? 'N' : 'Y');
}

where 123 and 456 are product codes of these products

Then activate the My changes add-on and check the result

Hope that helps

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 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • simenkl
  • Member
  • Members
  • Join Date: 27-Feb 14
  • 36 posts

Posted 24 December 2014 - 12:14 PM #3

Thank you ever so much! That worked perfectly! :grin: Merry christmas!

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

Posted 24 December 2014 - 02:10 PM #4

Thank you ever so much! That worked perfectly! :grin: Merry christmas!


You are welcome! Merry Christmas to you too!

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 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)