Skip to content

Instantly share code, notes, and snippets.

View antoineguilbert's full-sized avatar
👋

Antoine Guilbert antoineguilbert

👋
View GitHub Profile
@antoineguilbert
antoineguilbert / sql-prestashop-products-with-categories
Created December 9, 2016 14:34
Get easily with a SQL command products with categories on Prestashop
SELECT p.id_product, pl.name, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as categories, p.price, p.reference, pm.name, pl.description_short, pl.description, p.date_add
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product)
LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category)
LEFT JOIN ps_category c ON (cp.id_category = c.id_category)
LEFT JOIN ps_manufacturer pm ON (p.id_manufacturer = pm.id_manufacturer)
WHERE pl.id_lang = 1
AND cl.id_lang = 1
AND p.id_shop_default = 1
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^folder1(.*)$ http://www.newdomain.com/$1 [L,R=301]
</IfModule>
RewriteEngine on
RewriteCond %{SERVER_NAME} =yoursite.com
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
cat /var/log/apache2/access.log | grep "\[05/Sep/2010" |awk '{print $1}' | sort | uniq | wc -l
@antoineguilbert
antoineguilbert / get-referring-url-apache-logs
Last active January 16, 2017 08:28
Get top referring URL via Apache logs
cut -d'"' -f4 /var/log/apache/access.log | grep -v '^-$' | grep -v '^http://www.yoursite.com' | sort | uniq -c | sort -rg
UPDATE ps_product_shop SET available_for_order =0 WHERE id_product IN (
SELECT id_product
FROM `ps_product`
);