Active forum topics

©2006-2017 IAAI Software

Contact Us Privacy Policy

Short code doesn't work

Submitted by randza on Fri, 2016-08-19 13:12.

Hi all,

I have just upgraded my wp installation. after that, I see that short code doesn't work, It gives a "no results" page even if I look for a product/keyword I have in my product feed.

Do you know what is wrong ?

Any help ?

Cheers,

Randza

Submitted by support on Fri, 2016-08-19 13:29.

Hello Randza,

I presume there have been no database changed - just an upgrade of WordPress but still using the same database as before (and therefore the same database as Price Tapestry)?

Do the A-Z page work e.g. /merchant, /category etc.?

Can you confirm that it is a search from the main page (referred to as the Container Permalink in the documentation) e.g. /shopping, or do you mean a specific search shortcode embedded in another page or post, e.g.

[pto search="Keyword"]

Thanks
David.
--
PriceTapestry.com

Submitted by randza on Fri, 2016-08-19 13:40.

Hello David,

Thank you for your quick answer.

The database is the same (it's just an upgrade)

AtoZ, merchant or category page work fine

>> [pto search="Keyword"] doesn't work for example.

When I do www.mywebsite.com/pt/search.php?q=keyword it is fine (I have products listed)
then when I do [pto search="keyword"] inside the article (wp) there is nothing

Submitted by support on Fri, 2016-08-19 13:48.

Hello Randza,

Ah - I think it will be down to the urldecode()'ing of $pto_q which I have come across before - it's not strictly necessary but was in place as a backup due to instances that I had encountered previously with URL encoded values being passed through, however there is a scenario related to PHP internal character encoding that can cause urldecode() to return an empty string.

To remove the call, edit the plugin file pto/pto.php and look for the following code at line 159:

  $pto_q = (isset($pto_q)?pto_common_normalise(urldecode($pto_q),":\."):"");

...and REPLACE with:

  $pto_q = (isset($pto_q)?pto_common_normalise($pto_q,":\."):"");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by randza on Tue, 2016-08-23 21:20.

David,

Thank you for your quick answer.

I re-uploaded the pto folder, shortcode seems working but now, I get this error message in the sidebar and the homepage (featured product)

%IF_WIDGET% %ELSE_WIDGET% %ENDIF_WIDGET% %IF_WIDGET% %ELSE_WIDGET% %ENDIF_WIDGET%

Have you any idea of this ?

Submitted by support on Wed, 2016-08-24 09:44.

Hi,

I remember adding support for IF_WIDGET / ELSE_WIDGET / ENDIF_WIDGET to an earlier distribution for you so it looks like this is currently present, whilst the same templates are in use. To re-instate, edit pto_featured.php and look for the following code at line 73:

  $each = $pto_html_featured_each;

...and REPLACE with:

  $each = $pto_html_featured_each;
  $each = str_replace("\n"," ",$each);
  global $pto_featuredIsWidget;
  if (!isset($pto_featuredIsWidget))
  {
    $each = preg_replace('/%IF_WIDGET%(.*)%ELSE_WIDGET%/','',$each);
    $each = str_replace("%ENDIF_WIDGET%","",$each);
  }
  else
  {
    $each = str_replace("%IF_WIDGET%","",$each);
    $each = preg_replace('/%ELSE_WIDGET%(.*)%ENDIF_WIDGET%/','',$each);
  }

And then look for the following code at line 190:

  extract($args);

...and REPLACE with:

  global $pto_featuredIsWidget;
  $pto_featuredIsWidget = TRUE;
  extract($args);

Cheers,
David.
--
PriceTapestry.com

Submitted by randza on Wed, 2016-08-24 21:29.

David,

Thank you for your quick answer
I have made the change but the problem remains.
I still have, in the sidebar and in the home page, the %IF_WIDGET% and so on message.

Do I need to re-install all the pto plugin ?

Thanks

Submitted by support on Thu, 2016-08-25 08:06.

Hi,

Re-installation shouldn't be necessary - please could you post the contents of your Featured Products / Each template (wp-admin > Settings > PriceTapestry.org) and I'll check that the IF / ELSE section is structured correctly for the regular expressions used to remove them...

Thanks,
David.
--
PriceTapestry.com

Submitted by randza on Thu, 2016-08-25 12:59.

Hi,

Here are the contents of featured products /Each

{code saved}

Thanks

Submitted by support on Thu, 2016-08-25 13:58.

Thanks Randza,

I just realised the REPLACEment above was missing the step to "flatten" the template value in order for the preg_replace() calls to work.

Corrected above, with the addition of this code at line 2 of the replacement:

  $each = str_replace("\n"," ",$each);

Cheers,
David.
--
PriceTapestry.com

Submitted by randza on Fri, 2016-08-26 21:52.

Hi,

I thank you very much David. It works ! Greeatttt !

Cheers,

Submitted by randza on Fri, 2016-08-26 22:45.

Hi David,

It works well now. the %IF% messages disappeared.

How to skip the product page and send directly to the buy url (to the merchant url ?) opened in another window (target blank) ? [I had this configuration and after the update, it disappeared)

Thanks

Submitted by support on Sat, 2016-08-27 10:58.

Hi,

Firstly, in pto_common.php look for the following code beginning at line 58:

  if (isset($product->api))
  {
    return $product->buy_url;
  }
  else
  {
    return get_bloginfo('url').$pto_config_productBaseHREF.pto_common_hyphenate($product->normalised_name).".html";
  }

...and REPLACE with:

  if (isset($product->api))
  {
    return $product->buy_url;
  }
  else
  {
    return pto_common_buyURL($product);
  }

Next, edit your Featured Products / Each and Search Results / Each templates ( wp-admin > Settings > PriceTapestry.org ) and locate each instance of:

<a href='%PRODUCT_URL%'>

...and REPLACE with:

<a href='%PRODUCT_URL%' target='_BLANK'>

Now, if you are using tracking ($config_useTracking set to TRUE in Price Tapestry config.php and under the External section of PriceTapestry.org configuration ( wp-admin > Settings > PriceTapestry.org ) that is all that is required.

If you are not, then two additional modifications are required - in pto_search.php look for the following code at line 357:

    $sql2 = "SELECT id,name,normalised_name,image_url,description,price,rating FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";

...and REPLACE with:

    $sql2 = "SELECT id,name,normalised_name,image_url,description,price,rating,buy_url FROM `".$pto_config_databaseTablePrefix."products` WHERE id IN (".$in.")";

And finally the following code at line 382:

      $pto_searchResults[$k]->rating = $rows3[$product->id]->rating;

...and REPLACE with:

      $pto_searchResults[$k]->rating = $rows3[$product->id]->rating;
      $pto_searchResults[$k]->buy_url = $rows3[$product->id]->buy_url;

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by randza on Wed, 2016-08-31 11:47.

Thank you David for your help

Everything is OK.

Best Regards,

Submitted by uck on Tue, 2017-06-13 22:10.

Hi David,

I got the same original problem described by Randza above:
1) the product shortcode is no working,
2) if i execute https://example.com/shopping/?pto_q=mani i do not get any result (while if I run https://example.com/pt/search.php?q=mani i get a the correct result)

Moreover, I'm using virtual pages, but if i try to import, WP fails to import. What shall I do to spot the problem?

Thank you

{links saved}

Submitted by support on Wed, 2017-06-14 07:43.

Hi,

I notice from the merchant / category / brand links from the /shopping page that there are no results there either so I wanted to check if products had ever shown in this installation or if it is a first time installation with nothing showing, or it was previously working with version 2 and having upgraded to version 3 now nothing is showing?

Thanks,
David.
--
PriceTapestry.com

Submitted by uck on Wed, 2017-06-14 12:29.

Hi David,

I have fixed the problem!

It was my fault: I have installed Pricetapesy NOT in the same Worpdress DB.

Thank you for the support