If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Customization from the Admin / Display only selected products in the second language of the site

Display only selected products in the second language of the site

Started by honatto on 31 Oct 2018, 9:14 PM · Views: 4,202

Results 1 to 5 of 5
31 Oct 2018, 9:14 PM
#1
honatto avatar

honatto

New Zenner

Join Date:
Jun 2018
Posts:
11
Plugin Contributions:
0

Post #1 by honatto

Greetings,

I use Zen Cart partly as a news platform. Any news is submitted through the catalog as categories/product. Then the front lists all the "products" in order to show the news.

The problem: I have two languages - Bulgarian and English. My native users are interested in EVERYTHING submitted. The foreigners should only read selected (major) news, the minor ones just push these below.

I was thinking of messing with the code. But I can't really get into the essence of the way news is displayed. Simply put - I wanted to do a DB check if the news is translated (second textarea contains anything) and if so only then display. Else don't, because currently it displays the picture and text/heading are empty.

This is really important to my work and If someone is really interested in helping me, I can provide you with details.

Thanks in advance!

1 Nov 2018, 10:14 AM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Post #2 by twitchtoo

You can accomplish this in a few ways:

Option #1 - Language Groups
Use the Twitch Wholesale Attributes with Product Control Switch and point the entire product filter system at a prefilter for languages which gives you:

Custom Coded

  • language groups
  • news filter

Out of the Box

  • product, wholesale, retail and guest groups
  • retains group pricing if you're using it

These 'groups' wholesale for example could be a 'language group'. English = Retail Group, Bulgarian = Wholesale Group. You can then get really fancy with the news filter for these groups at the product level with the control switch - On/Off/Both groups.

Option #2 - Secure News Data
The same is possible with Twitch Restrict if you want to also restrict any public access to the data - data is filtered on the server behind closed doors before it is released to the HTML/PHP running the live site.

There's also no limit on the 'Twitch' groups you could setup so it's already scalable :)

Option #3 - Fast and Easy
A third and exceptionally simple method is to add a language filter tied to a simple true/false gate for the news data before it is displayed on the site. This wouldn't be 'secure' in that the data would already make it to the output HTML/PHP. Visually it would look the part functionally other countries may find an interest in your news ;)

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

11 Nov 2018, 3:14 AM
#3
honatto avatar

honatto

New Zenner

Join Date:
Jun 2018
Posts:
11
Plugin Contributions:
0

Post #3 by honatto

Thanks for the response, I actually took the easy path myself.

Edit: includes/index_filters/default_filter.php
Add the following code to all listing queues

                 and pd.products_name != ''
		 and pd.products_description IS NOT NULL
		 and pd.products_description != ''

The logic behind it: English user enters the website, only articles with value in name and description get shown.

Downsides:

  1. It affects both languages, but the main language uses name / description.
  2. Articles can still be accessed through direct link and they will remain untranslated. - which can be fixed by putting "Not available in English." in the description and then adding this exception to the query above.
  3. I have "top articles" as in Top 1 and Top 2/3 and articles appear regardless of the query above => either more editting or just translate them always.
  4. Simple and practicle, but not sure if it can't brake anything. Testing it currently.
  • Feel free to suggest ideas or mention more possible outcomes I didn't take in account.
11 Nov 2018, 3:24 AM
#4
honatto avatar

honatto

New Zenner

Join Date:
Jun 2018
Posts:
11
Plugin Contributions:
0

Post #4 by honatto

I can't edit the post above, but simply

and pd.products_name != ''

is enough for my cause. I do sometimes put a title and type "expect more information soon".