• I am using a eCommerce theme called Storepress Premium and the author is not online anymore so there is no support. I am trying to revised a shortcode. I found the code that displays products based on featured, best-seller, latest and by tag. I have tried them and they all work except the one based on tags. Can anyone see if there might be a typo below that is causing it to not show any results?

    class TagProducts extends SmartCategory {
    	static $_slug = "tag";
    
    	function smart ($options=array()) {
    		$this->slug = self::$_slug;
    		$tagtable = DatabaseObject::tablename(Tag::$table);
    		$catalogtable = DatabaseObject::tablename(Catalog::$table);
    
    		$this->tag = urldecode($options['tag']);
    		$tagquery = "";
    		if (strpos($options['tag'],',') !== false) {
    			$tags = explode(",",$options['tag']);
    			foreach ($tags as $tag)
    				$tagquery .= empty($tagquery)?"tag.name='$tag'":" OR tag.name='$tag'";
    		} else $tagquery = "tag.name='{$this->tag}'";
    
    		$this->name = __("Products tagged","Mycart")." "".esc_html(stripslashes($this->tag)).""";
    		$this->uri = urlencode($this->tag);
    		$this->loading = array('where'=>"p.id in (SELECT product FROM $catalogtable AS catalog LEFT JOIN $tagtable AS tag ON catalog.parent=tag.id AND catalog.type='tag' WHERE $tagquery)");
    	}
    }
  • The topic ‘Help editing a shortcode to display products’ is closed to new replies.