Jump to content



Member Since 02 Aug 2016
Offline Last Active Yesterday, 09:24 PM

Topics I've Started

Mysql Database For A Large Number Of Products

20 March 2018 - 06:30 AM

7. after started website, on some time later(might be years later), I might will need to pay someone to customize entire system like this; each language will have their own separate table on database. because cs-cart company don't wants extra work for themselves and keeps all languages in one table. but if you search anything, MySQL server has to scan every records even if it's not included on those tables. for example, if you search in Russian Language anything, logically we know it's can't be found in arabic or chinese tables. so, why then MySQL server has to scan all those records? of course, in this case, you will have to have a separate URL stricture for every language and visitors will search from there. for example; ru.cs-cart.com visitors has to search only from Russian language tables. imagine that you have 1 million products, 10% of them has variation of 6. so, 100K * 6 = 600K + 900K = 1.5 million record and if you have 10 languages, it will be 15 million records. so, if someone wants search anything from Russian Language, why MySQL has to scan 15 Million records? it can be done with scanning just 1.5 millions records. but these things I will need to think very later, might be after years. but good to know now upfront now.




If you really have 1 million products then you won't have a simple setup. You will probably use Oracle database or such and not Mysql. However, if you really desire to use different languages then why not change the database all together? It is way easier to do, since you will only have to change the 'database' in the config field ('my_database' . CART_LANGUAGE) and change some session based values. You can also create functions / operations / triggers in mysql which would update the value across all the databases e.g. for the settings database.


Kind regards,

Add-Ons By Poppedweb: Full Page Cache

20 December 2017 - 07:32 PM

Hello guys,


As many of you know we have been working on a very sophisticated full page caching add-on. The day has finally come, meaning we will release it to the public. After hundreds of hours of work we have decided that as of right now there are plenty of features to work with (though more are on the way!).


The more products and visitors your store has, the higher load it has to withstand. If the number of products and simultaneous visitors exceeds the number a store and its server can handle, the store dramatically slows down and can crash.


Thanks to the latest improvements, such as full page caching and PHP 7 support, CS-Cart now works even faster than usual and handles a high load even with 125,000 products on board.


The full-page caching works without any extra server configuration, allowing your store to withstand a higher load and speed up page loading on the first and repeated visits up to 25 times. You can expect the TTFB to lower to 25ms!


This is how it works: when a customer opens a page, CS-Cart stores (i.e. caches) that page into memory. When another customer opens the same page, CS-Cart quickly retrieves it from memory. As a result, the second customer gets that page quickly - even on the first visit.


Performance Testing


To show the performance of a properly configured CS-Cart store with full-page caching, we created a highload demo store and tested its stamina.


For testing we have made a program which will test the load and will check for the TTFB of the HTML page. This resulted in the following impressive graph (this is first load with fully initialized sessions).




Why you need Full page cache addon:


Your website will get a significant performance boost, resulting in happier customers and possibly a better conversion rate as well.

Under load your website will perform better, allowing for more visitors at once.

Because you website's TTFB (Time To First Byte) is reduced, your SEO will be ranked higher.


Why you should use this Full Page Caching addon:


A database is not used to store the statuses of the files. Instead, they are stored using a custom file / storage engine that can detect if the file is valid.

Intensive PHP functions have not been used, this includes but is not limited to: preg_match, preg_match_all and str_replace.




Does it work with HTTPS? - Yes.

Does it support multiple languages / auto language detection? - Yes.

Does it allow multiple currencies? - Yes.

What if I update a product / a category / a page? - The affected cache will be removed.

What do you mean with no database? - Files are stored using a defined set of parameters. It will use default php functions to read the file age, file existence and many more things to refrain from the database.




- Hole punching (allows you to remove blocks from the cache, e.g. recently viewed) (3rd week).

- Backend that will allow you to see the file storage in a more efficient manner (3rd week).

- Auto CRON jobs that will be queried from our server if neccessary (e.g. for garbage collection and such) (4th week).

- Store the keys / values for hole-punching in redis / memcached / file cache (5th week).

- Preload data which is queried from the database into a file (which can be stored in redis / memcached / file cache) (6th week).


Have we intrigued you?


If you have any questions, feel free to ask us in either the thread or via e-mail: info@poppedweb.com 

You can buy the add-on at: https://poppedweb.co...ull-page-cache/

Nginx Full Page Caching

22 June 2017 - 03:25 PM



First of all I'd like to note that using this code is at your own responsibility, therefore I sincerely recommend using some sort of backup site first as this is still in testing fase.


Known issues (feel free to help out)

- Cache can not be cleared for now, I am currently working on it but if you have any ideas on how to empty a cache directory feel free to help out. For now you can do the following: 

  1. 'sudo rm -rf /etc/nginx/cache'
  2. 'sudo mkdir /etc/nginx/cache'
  3. 'sudo chmod 777 /etc/nginx/cache'

- Adding content changing buttons through code is annoying, I am looking for a way to simplify this but I havent found one yet.


Feel free to help me out with this project so that we can all enjoy it. But nonetheless, let's get right into it!


Why Nginx Full Page Caching?

Nginx full page caching basically is the same as varnish full page caching. The only two differences here are that NGinx is the reverse proxy webserver and can decide immediately wether a URL needs to be cached or not, instead of (like varnish) passing the url to a different webserver. And, the fact that it can cache large PHP queries, which will speed up the server as well.


What is the average speed you can gain?

In my testing environments I achieved results that were mindblowing, they showed that the store could achieve response times in under 100ms which resulted in page loads under 300ms!



- Server knowledge (Unix in particular, this was also the OS I used for testing)

- Some coding skills  (for linking the buttons to javascript code)

- NGinx as your webserver

- CS-Cart 4.5.2 (only version that was tested, it might be compatible with older versions as well).


    - demostore.com/en/beautiful_categorie/product-en

    - demostroe.com/de/schoene_kategorie/produkt-de

    - demostore.com/nl/mooie-categorie/product-nl


Make CS-Cart ready!

1. Upload the provided package

2. Add the following class 'nginx-no-cache' to buttons who can change content (think about buttons who will cause a permanent change in the page, e.g. login button.)

3. Install some sort of cookie finder on the page and check if the cookie 'no-cache' is there whenever you press a button, or do anything on the page (this is very important, otherwise clients might receive old cache).


Make NGinx ready!

1. Make a backup of your config file (etc/nginx/sites-available/default)

2. Make the cache directory: (sudo mkdir /etc/nginx/cache) and give it 777 permissions.

3. Add the following code to the top of the file (!!!! not inside the 'server {' !!!!) (You can change the inactive time in case you want to)

fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=microcache:1024m inactive=2h;
add_header X-Cache $upstream_cache_status;

4. Make sure to add the following nginx config in the 'server {'. Furthermore you should add your own exception URL's (THIS IS VERY IMPORTANT, IF YOU HAVE LANGUAGES SHARING THE SAME URL INCLUDE IT HERE), this is very important as I do not know what seo changes you might have done

    #   Cache everything by default
    set $no_cache 1;

    #   Only cache GET requests
    if ($request_method != GET){
        set $no_cache 1;

    #   Don't cache the following URLs
    if ($request_uri ~* "/(YOUR ADMIN URL|dispatch=checkout.checkout|dispatch=checkout.cart)"){
        set $no_cache 1;

    #   Don't cache peeps with cookies (addon)
    if ($http_cookie ~* "no_cache"){
        set $no_cache 1;

5. Now we have to add something to the following segment: 

    #   Processing PHP scripts
    location ~ \.php$ {

It should look like this in the end

# Processing PHP scripts
location ~ \.php$ {     
        root /data/www/****;
        proxy_read_timeout 61;
        fastcgi_read_timeout 61;
        try_files $uri $uri/ =404;

        #   The path to the PHP-FPM daemon socket
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

        # fastcgi caching
        fastcgi_cache microcache;
        fastcgi_cache_key $scheme$host$request_uri$request_method;
        fastcgi_cache_valid 200 301 302 3h;
        fastcgi_cache_use_stale updating error timeout invalid_header http_500;

        fastcgi_pass_header Set-Cookie;
        fastcgi_pass_header Cookie;
        fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

        fastcgi_cache_bypass $no_cache;
        fastcgi_no_cache $no_cache;

6. Now save the config file (and double check it)

7. Restart nginx (sudo service nginx restart)


What will the final version include?

1. Cache will be cleared whenever you want to (just like normal, demostore.com/admin.php?cc&ctpl).

2. Buttons will be manageable through a nice UI in the backend.

3. Toggle the nginx proxy cache through the settings menu

4. And many more things to come!


Some final words

First of all I'd like to thank hungryweb for sharing some of his knowledge with me. Secondly, I'd like to remark that this addon is in beta and that I will release an official version with many more features soon. Feel free to help me out developing it and give me any tips and tricks! I ofcourse will be happy to assist you if you have any questions regarding this topic!


Have a good one,

PoppedWeb (and HungryWeb)

Filters Are Acting Very Weird

28 April 2017 - 07:41 AM



So today I started development for a client of mine but then I came across something very weird. The issue is as follows.


I started with adding a few filters but than I wasn't able to select multiple filter variants (e.g. color) whilst in a different category I was able to do this. And I checked this multiple times (even in the database) and the properties are the exact same. Both of the filters / properties are the EXACT same except for a few variants.


So what is causing this effect? The filter types are both on multiple (defined in the features) but it doesnt allow me to select multiple?


After digging a bit more I also decided to make every filter either text or multiple. This also did not fix my problem. Does anyone have an idea on how to fix this filter behaviour?

Special Cookie On Sign In / Add To Cart

24 April 2017 - 12:42 PM



So after playing a bit with Nginx caching I realised that it would be farily hard to implement HTTP caching, where as php caching is fairly easy. So this kind of made me wonder how I could implement this, because I am struggling with one thing which is that whenever a user does something (like adding something to their cart or signing in) it needs to server fresh content.f


So my idea was to rewrite the login function and the add to cart function and add a line which will set a cookie, something like, unique_content. Where can I find these lines, and can anyone perhaps guide me through this process?


Sincerely Yours,



This doesn't just apply for the add to cart and sign in function but also for the wishlist and compare functions


// EDIT 2

Or we can just disable the sid_customer given on the first pageload and server it whenever someone does one of the following actions