You are here:  » Short Code


Short Code

Submitted by ser_seven on Mon, 2012-08-27 00:31 in

Hi
There is a way to display in WP page the products of one category present in PT?
I created in WP category Electronics and here I would like to see the products in my category Electronics (present in PT).

I looked at the Shortcodes page but have not found anything that returns the list of products in the selected category.

So I decided to try this Shortcode
[pto search = "category: Electronics"]
This found but when I click on the second page of results I have this page
http://www.mydomain.com/shopping/2 (white page) instead of this page
http://www.mydomain.com/elettronics/2

Do u have solution ?

Tnk u

Submitted by support on Mon, 2012-08-27 07:24

Hello Ser.

That is the right short code to use, but watch out for spaces, it should be;

[pto search = "category:Electronics"]

Now by default, page 2 for the results shown by that short code would link to the clean URL version of the category search results, which by default would be:

/category/Electronics/2.html

The /category part of the above URL is the value for "Category Base HREF" in wp-admin > Settings > PriceTapestry.org; so the first thing to do is double check that it is set correctly. However, it is possible that /category conflicts with WordPress/Theme category in your particular installation, in which case try something alternative for "Category Base HREF" foe example "/productcategory" (without the quotes) - that should be all it is...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by ser_seven on Mon, 2012-08-27 12:58

Hi
tnk u
The problem is /category conflicts with WordPress/Theme category

I have another question: it's possible remove in pagination 2,3,4,5,6 ... remove "search bar" and "Search or browse by merchant, category or brand" as first page results ?

Tnk u

Submitted by support on Tue, 2012-08-28 08:50

Hello Ser,

Try this; first of all we add a new shortcode attribute to tell the pagination to use the current URL rather than the container permalink. To do this, edit pto.php and look for the following code at line 511:

if (isset($atts["minprice"])) $pto_minPrice = $atts["minprice"];

...and REPLACE with:

global $pto_useCurrent;
if (isset($atts["usecurrent"])) $pto_useCurrent = TRUE;
if (isset($atts["minprice"])) $pto_minPrice = $atts["minprice"];

Next, in pto_search.php look for the following code at line 585:

$navigationBaseHREF = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($parts[1])."/";

...and REPLACE with:

if (isset($pto_useCurrent))
{
  $navigationBaseHREF = "?pto_page=";
  $rewrite = FALSE;
}
else
{
  $navigationBaseHREF = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($parts[1])."/";
  $rewrite = TRUE;
}

Then as your shortcode, use:

[pto search="category:Electronics" usecurrent="TRUE"]

Hope this helps!

Cheers,
David.
--
PriceTapestry.com