You are here:  » Some Questions


Some Questions

Submitted by soulwind on Mon, 2016-10-10 07:43 in

Good Day

I'm back in pricetapestry after a long time. Now i have some questions to the newest version:

1.) How can i add extra informations like category, brandname or ean to product.php?
2.) I tried to add an extra jump.php link to the product.php but this did not work out? I've tried

<a href='".tapestry_buyURL($p)."'> and <a href='<?php print tapestry_buyURL($mainProduct); ?>

3.) How can i display random products on the index.php or in another php site?

That's for the moment (more to come) ;)

Thanks!

Submitted by support on Mon, 2016-10-10 09:36

Hi,

Re 1;

To add extra product record fields to the main product page (html/product.php) the array variable to use is now $product_main. If the fields are optional, it's best to use an IF condition, so for example to display `ean` but only if a value exists, use something like;

<?php if ($product_main["ean"]): ?>
EAN: <?php print $product_main["ean"]; ?>
<?php endif; ?>

Re 2;

Second version is almost correct, just need to use the new array variable $product_main, have a go with:

<a href='<?php print tapestry_buyURL($product_main); ?>

Re 3;

For random Featured Products on the home page of a Price Tapestry installation; check out this thread. For an external site, I am currently preparing standalone responsive templates that do not rely on a 3rd party framework, and as soon as these are ready I will prepare a featuredExternal.php with random support, and add that to and update the instructions for searchExternal.php and pricesExternal.php this this thread. Look out for this shortly after the next release of Price Tapestry later this month, and i'll post a note here as soon as the new external scripts have been prepared...

Cheers,
David.
--
PriceTapestry.com

Submitted by soulwind on Mon, 2016-10-10 09:39

Thanks for your fast support!! ;)

Another question, i've tried to install the amazon api script here http://www.pricetapestry.com/node/2912 .. but no results are displayed? I made all the changes mentioned and insereted amazon aws things. Is there a new version of this script somewhere or how can i make it work?

Regards&Thanks

Submitted by support on Mon, 2016-10-10 10:16

Hi,

If you are not seeing Amazon results, one possibility is that URL Wrappers are not enabled on your PHP installation - more info on that setting at;

http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

However, it is becoming more common for CURL to be installed which can be used as an alternative. To try CURL instead, edit amazon.php and look for the following code at line 165:

    MagicParser_parse($url,"myAmazonRecordHandler","xml|ITEMSEARCHRESPONSE/ITEMS/ITEM/");

...and REPLACE with:

    $ch = curl_init($url);
    curl_setopt($ch,CURLOPT_HEADER,0);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    $xml = curl_exec($ch);
    MagicParser_parse("string://".$xml,"myAmazonRecordHandler","xml|ITEMSEARCHRESPONSE/ITEMS/ITEM/");

If still no results, you can display the API response by adding the following code immediately after the above:

    print "<pre>".htmlentities($xml,ENT_QUOTES,$config_charset)."</pre>";

The Amazon API error response is normally quite detailed; let me know if you're not sure from what is displayed where the problem lies, or of course if there is no difference (no response at all) and I'll check it out further with you.

The most common error that I have come across is that the key pair are not associated with the Product Advertising API. If it will not affect any other applications you have using Amazon, this is normally resolved by deleting the master key and then re-creating it and using the new access key / secret access key...

Once up and running, you might want to consider instead using the new Asynchronous Amazon and eBay API Modules instead, which load into tabs and so do not slow down page generation time at all...

Cheers,
David.
--
PriceTapestry.com

Submitted by soulwind on Mon, 2016-10-10 10:37

Changing to curl made it work ;)

But if i added print "".htmlentities($xml,ENT_QUOTES,$config_charset);.""; i got an error 500 ;)

Regards

Submitted by support on Mon, 2016-10-10 11:16

Glad you're up and running!

Syntax error corrected above...

Cheers,
David.
--
PriceTapestry.com

Submitted by soulwind on Mon, 2016-10-10 11:51

Another small question. I've tried to make the links on hover underlined. So i changed the foundation.min.js in /vendor. But it does not take the changes? When i do it in my browser opening dev mode it works?

Regards

Submitted by support on Mon, 2016-10-10 11:57

It's probably best added in html/default.css - have a go with:

a:hover {
    text-decoration: underline !important;
  }

Using the !important flag will ensure that it overrides anything in foundation.min.css.

(don't forget to do a hard refresh normally CTRL+F5 after changing CSS to ensure that it is reloaded by your browser)

Cheers,
David.
--
PriceTapestry.com

Submitted by soulwind on Wed, 2016-10-12 08:28

Hi David

I've tried to add the async version to searchresults but when i click on "Amazon"-Tab nothing happens? I changed already to:

$ch = curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$xml = curl_exec($ch);
MagicParser_parse("string://".$xml,"AmazonRecordHandler","xml|ITEMSEARCHRESPONSE/ITEMS/ITEM/");

But that didn't help me out?

Thanks for help

Submitted by soulwind on Wed, 2016-10-12 08:44

strange thing .. i've made this change:

To implement this, edit search.php and look for the following code at line 541:"

require("html/noresults.php");
...and REPLACE with:

require("html/searchresults.php");

and now if there are no results the amazon tab is working? So it's just not working when there are results and i click on the amazon tab?

Regards

Submitted by soulwind on Wed, 2016-10-12 09:06

It's also working on prices.php?

Submitted by support on Wed, 2016-10-12 09:17

Hi,

Does the tab load when you click the Amazon logo and just show the spinner, or does the tab not even open and normal search results are still displayed?

The latter would indicate a JavaScript error on the search results page - if that's the case, could you perhaps check using your browser's console tool and see if a JavaScript error is displayed?

In Firefox, Tools > Web Developer > Web Console will show in the default view if any JavaScript errors have occurred on the page...

Thanks,
David.
--
PriceTapestry.com

Submitted by soulwind on Wed, 2016-10-12 09:25

Hi

The tab isn't even loading? I've tried to use the web console but no error is displayed? But i see that amazon images are loaded in another tab there? Can i send you the URL by mail?

Regards

Submitted by support on Wed, 2016-10-12 09:29

Sure - email me a link direct to a search results page where it's not working and I'll check it out...

Cheers,
David.
--
PriceTapestry.com

Submitted by soulwind on Wed, 2016-10-12 13:24

Hi, next question ;)

1.) How can i add $product_main["category"] to the tag of products.php if the title has only 1 word in it?
2.) How to add the name of my site at the end of every ?

Regards

Submitted by support on Wed, 2016-10-12 14:32

Hi,

> 1.) How can i add $product_main["category"] to the tag of products.php
> if the title has only 1 word in it?

To do this, edit products.php and look for the following code at line 64:

      $header["title"] = $product["products"][0]["name"];

...and REPLACE with:

      $header["title"] = $product["products"][0]["name"];
      if ((!strpos($header["title"]," ")) && $product["products"][0]["category"])
      {
        $header["title"] .= " ".$product["products"][0]["category"];
      }

> 2.) How to add the name of my site at the end of every ?

To include your site title (from $config_title) on the end of every dynamically generated page title, edit html/header.php and look for the following code at line 14:

<title><?php print (isset($header["title"])?htmlspecialchars($header["title"],ENT_QUOTES,$config_charset):$config_title); ?></title>

...and REPLACE with:

<title><?php print (isset($header["title"])?htmlspecialchars($header["title"],ENT_QUOTES,$config_charset)." ":"").$config_title?></title>

Cheers,
David.
--
PriceTapestry.com