Skip to content

Instantly share code, notes, and snippets.

View salase's full-sized avatar

Eduardo Salas salase

View GitHub Profile
@salase
salase / prestashop17globals.txt
Last active April 10, 2019 06:14
Prestashop 1.7 smarty global variables
{$urls.base_url} -> Store address
{$urls.current_url} -> Current address (url) where we are
{$urls.shop_domain_url} -> Store domain
{$urls.img_ps_url} -> Image root directory url
{$urls.img_cat_url} -> Url directory of images of the categories
{$urls.img_lang_url} -> Url of the language images directory
{$urls.img_prod_url} -> Url of the product images directory
{$urls.img_manu_url} -> Url directory of manufacturers images
{$urls.img_sup_url} -> Url of the providers directory
{$urls.img_ship_url} -> Url directory of images of carriers
SELECT p.id,tt.term_id
FROM (
SELECT p.id
FROM `wp_posts` p
join `wp_term_relationships` tr on p.id=tr.object_id and p.post_type='post'
join `wp_term_taxonomy` tt on tr.term_taxonomy_id=tt.term_taxonomy_id and tt.taxonomy='category' )
as p
JOIN wp_term_relationships tr ON tr.object_id = p.ID
JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id and tt.taxonomy = 'category'
SELECT p.id, p.post_title, p.post_name, p.post_parent,
(select pp.post_name from wp_posts pp where pp.id = p.post_parent) as parent_name
FROM `wp_posts` p
join `wp_term_relationships` tr on p.id=tr.object_id and p.post_type='post'
join `wp_term_taxonomy` tt on tr.term_taxonomy_id=tt.term_taxonomy_id and tt.taxonomy='category' and tt.term_id = <ID>
order by p.post_parent, p.id
SELECT t.term_id, t.name, count(tr.object_id), t.slug
FROM `wp_term_relationships` tr
join `wp_term_taxonomy` tt on tr.term_taxonomy_id=tt.term_taxonomy_id and tt.taxonomy='category'
join `wp_terms` t on t.term_id=tt.term_id
group by t.name
order by t.name
@salase
salase / WP_assign_featured_image
Last active February 8, 2017 15:45
Wordpress: Assign post's featured images via DB