Hello David,
I like to setup a page with shortcode [pto atoz="category"] = electronics
On this page will be all subcat categories is this possible?
Thx
Henk
Hello David,
I could do that but the filter isn't on this page.
Thx
Henk
Hi Henk,
Ah - OK, probably best support with a completely custom shortcode handler but have a go with something like this; firstly, in pto_atoz.php look for the following code at line 43:
$sql = "SELECT DISTINCT(".$module.") FROM `".$pto_config_databaseTablePrefix."products` WHERE ".$module." <> '' ORDER BY ".$module;
...and REPLACE with:
$parts = explode(":",$module);
if (($parts[0]=="category") && (isset($parts[1])))
{
$module = "category";
$category = $parts[1];
$sql = "SELECT DISTINCT(subcat) AS category FROM `".$pto_config_databaseTablePrefix."products` WHERE category='".$wpdb->escape($category)."' AND subcat <> '' ORDER BY subcat";
}
else
{
$sql = "SELECT DISTINCT(".$module.") FROM `".$pto_config_databaseTablePrefix."products` WHERE ".$module." <> '' ORDER BY ".$module;
}
And then where the link is generated, look for the following code at line 107:
$itemURL = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($row->$module);
...and REPLACE with:
if ($category)
{
global $pto_config_permalink;
$itemURL = get_bloginfo('url').$pto_config_permalink."?q=category:".urlencode($category)."&subcatFilter=".urlencode($row->$module);
}
else
{
$itemURL = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($row->$module);
}
...should be close!
Cheers,
David.
--
PriceTapestry.com
Almost, atoz is correct:
http://www.linkik.com/beeld-en-geluid
I use shortcode:
[pto atoz="category:Beeld en geluid"]
But the link through next isn't correct.
Thx
Henk
Sorry Henk should be pto_q in the URL. The last replacement:
if ($category)
{
global $pto_config_permalink;
$itemURL = get_bloginfo('url').$pto_config_permalink."?pto_q=category:".urlencode($category)."&pto_subcatFilter=".urlencode($row->$module);
}
else
{
$itemURL = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($row->$module);
}
Cheers,
David.
--
PriceTapestry.com
Yep almost,
subcatFilter = pto_subcatFilter
Thx
Henk
Ah yes, corrected above! Brain was in PT mode this morning...!
Cheers,
David.
--
PriceTapestry.com
Hi Henk,
That would actually be a search results shortcode, using:
[pto search="category:Electronics"]
Cheers,
David.
--
PriceTapestry.com