Single brand page
-
Hi,
I’m using this plugin with Divi and I tried to insert it into “single brand page” template. First of all, I had to modify the code for using [products] shortcode without “brands” parameter: in fact, without parameter, the shortcode retrieve ALL the products of the shop, instead I need to only show current brand’s products. But I can’t explice the brand name (for example [products brand=”microsoft”] because this is a “generic brand” template page.
I archieved it changingpublic function extend_products_shortcode_atts( $out, $pairs, $atts, $shortcode ) { if ( ! empty( $atts['brands'] ) ) { $out['brands'] = explode( ',', $atts['brands'] ); } return $out; }to
public function extend_products_shortcode_atts( $out, $pairs, $atts, $shortcode ) { if ( ! empty( $atts['brands'] ) ) { $out['brands'] = explode( ',', $atts['brands'] ); }else{ $out['brands']=array(basename($_SERVER['REQUEST_URI'])); } return $out; }because the last portion of the slug rapresent the brand…do you have better ideas?
Furthermore, I’ve another problem: products are showed without pagination, so if the brand has many and many products, loading is really slow. How to change it? I really need pagination, in other pages I selected 27 products for page; I tried to use the per_page parameter, but in this way it shows only the first n products, without pagination.
At last, I would really appreciate the possibility to choose how many products-per-row show: other pages has 3 products for row, it would be nice that single brand page has 3-per-row products too.Thanks for answering.`
The topic ‘Single brand page’ is closed to new replies.