Only just purchased PT, eager to get on with it.
However problem with initial installation, I have an existing word press installation, which includes product page within the root directory via MySql database and php,
My objective is to use PT instead of my php coding for the product pages with page pagination within the existing pages and keep the header, sidebar and footer intact as is already the case with the existing installation.
How and where do I install PT to achieve my objective?
I would appreciate whatever help you can give
For reference my site is www.partydressesandmore.co.uk/
I apologise in advance if this is a duplicate post only I could see me original after I submitted it
Regards
Paul
Hi David,
Having real difficulty with PT, probably as I'm a bit thick and knowledge of php is limited!
I replied to your answer above this morning, with the fact that I loaded PT OK apart from the message WARNING: $config_useRewrite is TRUE but .htaccess not found!
Despite that I have loaded a couple of datafeeds which I have chosen the register and trial import button. within /Store/admin
In order for me to see the results before confirming I think I need to view, and This is where I get a bit stuck!
I've uploaded searchExternal.php into my /Store/ directory which is where I've located PT. I have made a dummy page at www.parydressesandmore.co.uk/test-store/ and put in the script below and included the details as per instructions (see below)
<?php
$common_baseHREF = "http://www.partydressesandmore.co.uk/Store/";
$common_path = "/kunden/homepages/45/d229581650/htdocs/blog/";
$_GET["q"] = "category:Dresses";
require($common_path."searchExternal.php");
?>
However upon viewing the page I get the following warning
Warning: main(/kunden/homepages/45/d229581650/htdocs/blog/searchExternal.php) [function.main]: failed to open stream: No such file or directory in /homepages/45/d229581650/htdocs/blog/wp-content/themes/revolution_magazine-30/testdress.php on line 28
Fatal error: main() [function.require]: Failed opening required '/kunden/homepages/45/d229581650/htdocs/blog/searchExternal.php' (include_path='.:/usr/lib/php') in /homepages/45/d229581650/htdocs/blog/wp-content/themes/revolution_magazine-30/testdress.php on line 28
Am I completely off the track here, or is it that I've missed something?
thanks again in advance
Paul
Hi Paul,
It's important to get your main Price Tapestry installation working correctly before looking at searchExternal.php etc.; as the links generated depend on whether or not .htaccess in place when you have $config_useRewrite set to TRUE.
At the moment, in your config.php file (in /Store/) you have:
$config_useRewrite = TRUE;
...however, this setting requires a .htaccess file to be present in that directory, which is how the Apache web server implments the search engine friendly URLs. In that folder, you will see the file htaccess.txt. This is the template from which you need to make .htaccess, but first, you must edit it to contain the correct RewriteBase value. Open the file into you text editor, and change:
RewriteBase /
...to:
RewriteBase /Store/
Then upload the file to your webserver as .htaccess
If you are having difficulty creating a file of this name on your local computer, upload it as htaccess.txt, and then using your FTP program, try right-clicking on the file in the remote window where you should see a "Rename" (or similar) function, from where you should be able to rename the file to .htaccess
Alternatively, if you're not worried about search engine friendly URLs (because you are concentrating on the included content) then you could just set $config_useRewrite to false in config.php.
Finally, I think the only problem in your implementation of searchExternal.php is the value of $common_path. As Price Tapestry is installed in the /Store/ directory of your site, I think it should be:
$common_path = "/kunden/homepages/45/d229581650/htdocs/Store/";
...fingers crossed that is all it is!
Cheers,
David.
You're really going to be sick of me, assuming you're not already!
I've implemented what you instructed, but on my dummy page I get the following message:
Fatal error: Cannot redeclare translate() (previously declared in C:\Program Files\xampp\htdocs\wordpress\wp-includes\l10n.php:67) in C:\Program Files\xampp\htdocs\wordpress\Store\includes\translate.php on line 10
However on the good news front the .htaccess seems to have worked as the database setup all passed with out a hitch, and I could view sample data via http://www.partydressesandmore.co.uk/Store/ so a big thanks you!
Just need to look at how I can implement stuff on my site
Again any help is much appreciated
Regards
Paul
Hi Paul,
I've come across this before; the problem is the translate() function within Price Tapestry conflicting with a function of the same name in WordPress. It is easily fixed. Firstly, if you could edit pricesExternal.php and simply comment out or delete line 40:
require($common_path."includes/translate.php");
That should be enough to fix it, however you may also need to remove any calls to translate() that are present in the html modules used by pricesExternal.php. The easiest way to do this would be to open html/prices.php in your text editor, and then use the Search and Replace function to replace "translate" (without the quotes) with "sprintf". Alternatively, if you're comfortable with the PHP syntax you could just remove the function call altogether and just leave the original string...
Cheers,
David.
Hi David,
Again I've done as you've requested and I still have the same warning:
Fatal error: Cannot redeclare translate() (previously declared in /homepages/45/d229581650/htdocs/blog/wp-includes/l10n.php:67) in /homepages/45/d229581650/htdocs/blog/Store/includes/translate.php on line 5
However I was getting this warning before I had uploaded the pricesExternal.php file, though I have since uploaded into the /Store/ directory now and followed your instruction.
I also looked at the a link you sent me in your first post to me and read your exchanges with Neil regarding the same problem, I have gone into wordpress and tried also to amend the wp-includes/l10n.php file to see if I can amend the function translate... with an underscore which stopped WP working totally. However I never saw a reply from Neil to say he resolved the issue?
I'm really am sorry about this. But have you any further suggestions?
Hi Paul,
Could you email me your modified pricesExternal.php file and i'll check it out for you and add some debug code that should help...
Cheers,
David.
Hi David,
Thanks for your help on Saturday, Much appreciated.
since then I have been looking at a ways to incorprate all resulting pages produced by PT into the existing design, to be truthful I've been crawling through the forum to see if there is anything there to help me rather than asking for help, but alas here I am! So sorry to trouble you again
I see the conventional way to incorporate my design is to paste the code into the header and footer. However the problem I have is that all the code is wordpress code and mainly calling specific files from wordpress such as get_header etc. by transferring those into the PT header they won't be recognised presumbly as they are NOT called from the same directiry?
Is there anyway to overcome this?
Regards
Hi Paul,
There are several options here, but first of all, do you necessarily want your product pages to be surrounded by the same content as your lead in pages? Without performing a very tight integration into WordPress, the thing to do would be to take the approach you mention (copying the header and footer into /html/header.php and html/footer.php respectively) by viewing the source rather than trying to incorporate the WordPress code directly - and then removing from that source any broken components that rely on dynamic WordPress content.
However; another perhaps preferable option; is if there is little price comparison in your niche and you are using the script more as a datafeed <> product page website; is actually to modify the search results (which you are bringing in with searchExternal.php) to be direct links to the merchant rather than links to the product page (I'm still planning to help you out with paging for this tomorrow)...
This can be done by modifying searchExternal.php. In that file, you will find the following code beginning at line 210:
if ($config_useRewrite)
{
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."product/".tapestry_hyphenate($product["name"]).".html";
}
else
{
$searchresults["products"][$k]["productHREF"] = $config_baseHREF."products.php?q=".urlencode($product["name"]);
}
Simply REPLACE the above with:
$searchresults["products"][$k]["productHREF"] = tapestry_buyURL($product);
Cheers,
David.
Hi David,
That works beautifully, though I thought it was a nice feature to have the product comparison, but not important in this particular instance.
just two further requests please:
1. I tried to put a More >> button to replace the compare price link, as I'm not now comparing prices, but it only showed on some lines not all? why do you think that is?
2. if I wanted to put a dotted line under each line of product info, how would I do that. I tried it is the default.css by adding .searchresults tr {border-bottom: 1px dotted gray;} but didn't work? again its probably lack of knowledge, but can you just give me the heads up.
Once again, really appreciate your help
Paul
Hi Paul,
1) You should be able to do this in html/searchresults.php. Without comparison, the following section of code can be reduced significantly (lines 24-30):
<?php if ($product["numMerchants"] > 1): ?>
<em><?php print translate("from"); ?></em> <strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
<span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare Prices"); ?></a></span>
<?php else: ?>
<strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
<span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
<?php endif; ?>
So, to create a More button (I'm assuming you have an image for the button somewhere), you could replace the above code with:
<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
<span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><img border='0' src='/path/to/more.jpg' /></a></span>
(where /path/to/more.jpg is the src of the image you want to use as the More >> button)
2) Your .css looks correct, but when using searchExternal.php, Price Tapestry's default.css is not used - so you would need to add that section to your main WordPress theme .css. That should be all it is!
I'll get back to you via email later regarding paging on the searchExternal.php results.
Cheers,
David.
Hi David,
That works great, thankyou.
with the dotted line, I can only do it on td, so it doesn't have the same effect as there are several small breaks between the cells, can't think of another way to do it. any suggestion?
Look forward to receiving your mail regarding page nav, of course realised that you set the results number per page in config.php
cheers
Paul
Hi Paul,
I would have thought that:
.searchresults tr {
border-bottom: 1px dotted gray;
}
...should do the trick. If that's not working; one option would be to give the TR as defined within html/searchresults.php a class of its own... Each row is currently opened on line 4:
<tr>
...so replacing this with:
<tr class='searchresult'>
...and then in your .css:
.searchresult {
border-bottom: 1px dotted gray;
}
Cheers,
David.
turns out that you have to do a work around as follows.
seems to works OK,
.searchresults table { border-collapse:collapse; }
.searchresults td{
border-top: 1px dotted #CECECE;
}
thanks again
Hi David,
Sorry for being cheeky, but just wondered how you were getting on the page pagination script?
Appreciate your busy, but it would be really helpful
I hope you forgive my eagerness but I'm hoping to transfer my existing site over to TP over the next days, but can't do it with out having the page navigation.
Respectfully Paul
Hi David
You have seen on one of my installations that I use the code:
<?php
require("http://www.example1.co.uk/dishwasher/pricesExternal.php?q=".urlencode(get_the_title()));
?>
I am trying to do a similar operation but this time on a domain (example3) that is also sitting on the same server as example1.
However, I get the issues associated with php5 security such allow_url_fopen = off. For some reason I cannot change the setting using .htaccess or php.ini.
So have tried the following approach:
<?php
$external_baseHREF = "http://www.example3.cc/";
$external_path = "/homepages/1/xxxxxxxx/htdocs/example3.cc/data/";
require($external_path."pricesExternal.php?q=".urlencode(get_the_title()));
?>
This time the error message is
"Warning: require(/homepages/1/xxxxxxxx/htdocs/example3.cc/data/pricesExternal.php?q=Omega+Planet+Ocean+Seamaster+Mens+Watch) [function.require]: failed to open stream: No such file or directory in /homepages/1/xxxxxxxx/htdocs/example3.cc/wp-content/themes/magazine_10/index.php on line 27"
Any ideas what is wrong the coding above?
Hi Richard,
In that mode, you would need to use the calling code as follows:
<?php
$external_baseHREF = "http://www.example3.cc/";
$external_path = "/homepages/1/xxxxxxxx/htdocs/example3.cc/data/";
$_GET["q"] = get_the_title();
require($external_path."pricesExternal.php");
?>
This is because when the file to require() doesn't begin "http://", the whole thing is treated as a local file with no concept of the ?q= part, which only applies to URLs.
Hope this helps!
Cheers,
David.
Thanks David
Interestingly that has got rid of the error message but there are no price results nor does the remainder of the wordpress template e.g. sidebar
I will check forum as I do remember something similar to this before
Hi Richard,
It sounds like the database connection conflict issue - it just needs a small modification to includes/database.php, described in the following thread...
http://www.pricetapestry.com/node/2840
Cheers,
David.
Hi David
Thanks for that - I was just reading something similar on another thread.
Tried it without success.
Just to eliminate the uncertainly of the q variable I used the code:
<?php
$external_baseHREF = "http://www.example3.cc/";
$external_path = "/homepages/1/xxxxxxxxx/htdocs/example3.cc/data/";
$_GET["q"] = "Omega Planet Ocean Seamaster Mens Watch";
require($external_path."pricesExternal.php");
?>
I also added %20 within the gaps for the q variable just in case.
I have also checked file permissions - knowing nothing about this, I had a problem like this before on this server and you gave a solution using curl - is that relevant here?
Hi David
I have found this cURL example (source http://www.php-mysql-tutorial.com/wikis/php-tutorial/reading-a-remote-file-using-php.aspx) and adapted to my problem
<?php
// make sure curl is installed
if (function_exists('curl_init')) {
// initialize a new curl resource
$ch = curl_init();
// set the url to fetch
curl_setopt($ch, CURLOPT_URL, 'http://www.example3.cc/data/pricesExternal.php?q=.urlencode(get_the_title())');
// don't give me the headers just the content
curl_setopt($ch, CURLOPT_HEADER, 0);
// return the value instead of printing the response to browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// use a user agent to mimic a browser
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
$content = curl_exec($ch);
// remember to always close the session and free all resources
curl_close($ch);
} else {
// curl library is not installed so we better use something else
}
?>
The good news is that the wordpress page displays correctly as all templates are called.
However, the pricesExternal file is still not pulled through.
Am I heading in the right direction?
Eureka!!!!
Using thread http://www.pricetapestry.com/node/3043 and adding the error reporting snippet
error_reporting(E_ALL);
<?php
$external_baseHREF = "http://www.example3.cc/";
$external_path = "/homepages/1/xxxxxxxxx/htdocs/example3.cc/data/";
$_GET["q"] = "Omega Planet Ocean Seamaster Mens Watch";
require($external_path."pricesExternal.php");
?>
Still got error messages referring to undefined variables but price table was brought in ok. Removed the error reporting line error_reporting(E_ALL);
and it works perfectly. :)
I didn't think the translate problem was affecting my site as the other site worked ok and there were no error messages appearing.
I found this thread because I'm having similar problems. All well and good until this point because I can't find a file called pricesExternal.php
I proceeded to edit the prices.html file as detailed further on this thread in the hope that this would solve the problem but it hasn't.
I have removed the installation altogether with the aim of starting again from the beginning but this might be futile if I run into the same problem?
So before I start can you confirm whether I should have this file - I have even re-downloaded PT on the off-chance the file was skipped initially - but no, it still isn't there.
Hi Darren,
The external scripts are from the following thread:
http://www.pricetapestry.com/node/2289
Specifically, the versions for the latest distribution can be found in this post:
http://www.pricetapestry.com/node/2289#comment-12980
Cheers,
David.
Thanks David
OK, I'm going to set everything up with with this additional info and see how that goes...
Cheers
Darren
Hi Paul,
There are various ways to achieve your objectives; including a couple of scripts that I published recently in this thread regarding incorporating Price Tapestry data into a higher level content site - such as one powered by WordPress.
However, I would strongly recommend getting started with your Price Tapestry installation into a sub-directory on your website before looking into the integration. To that end; as you have WordPress installed in the top level directory; I would suggest creating a folder called /comparison/ and installing Price Tapestry into that folder.
With an installation into a sub-folder, when you are setting up your config.php as per the installation instructions you would use (based on the suggested folder name as above), a $config_baseHREF value as follows:
$config_baseHREF = "/comparison/";
If you are able to create a separate database for Price Tapestry then do so; otherwise, if it is to share your Wordpress database, then be sure to use a $config_databaseTablePrefix, for example:
$config_databaseTablePrefix = "pt_";
This will prevent the Price Tapestry tables from interfering with your WordPress tables. The reason I suggest a seperate database if this is an option is because it will prevent conflict between the database code in WordPress when you being to look at integration.
Once the standalone installation is working (and of course, just let me know if you need any further help), and you have got the first feeds online and working; we'll take it from there regarding setting it all up to work alongside your WordPress site...
Cheers,
David.