Displaying sideboxes for logged in visitors only

Customizing sidebox display based on customer status

Displaying a specific sidebox only for logged in customers can be done with the following steps:

  1. Locate the module for the sidebox (or boxes) that you want to treat like this. You’ll find them in includes/modules/sideboxes.

  2. Create override files for them by copying them to includes/modules/sideboxes/YOURTEMPLATE.

  3. Open the override file and find a couple of lines that look similar to

// test if box should display
$show_featured= true;

These were taken from the featured_products products sidebox and the variable name for your box will probably differ slightly. Then change them to

// test if box should display
if (!$_SESSION['customer_id']) {
$show_featured= false;
} else {
$show_featured= true;
}
  1. Upload to your server and enjoy.



Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified August 28, 2020 by Scott C Wilson (909e3a69).