PDA

View Full Version : Integrating the search from the api


eshop600
18-01-08, 23:00
I already use a cms system for my affiliate website, I'm wondering if I can just take the search feature from shopwindow and integrate it into my cms, can someone give me a few pointers on how to start this?

Many thanks
Simon

eshop600
20-01-08, 16:43
Even a few example of how to use the api, the documentation has none? am I missing something here?

Confuscius
20-01-08, 19:44
http://www.shopwindowforum.com/showthread.php?t=235 - previous example of CMS.

eshop600
23-01-08, 17:35
When I say samples, I ment coding samples not built websites. All I can find is the raw api commands etc.

How about some code samples with documentation, like here is how you put a search on an existing php website, this is how you show the search results, this is how you put the hot picks.

Anyone?

Andy
23-01-08, 18:31
When I say samples, I ment coding samples not built websites. All I can find is the raw api commands etc.

How about some code samples with documentation, like here is how you put a search on an existing php website, this is how you show the search results, this is how you put the hot picks.

Anyone?
Funnily enough, those ARE in the documentation http://www.affiliatewindow.com/documents/affiliates/documentation/shopwindow/Bespoke_Functionality.pdf
will show you how to add the search box or hot picks to any page you like.

eshop600
24-01-08, 00:20
Thanks for the help, I figured out how to add the search box myself (I'm not a php programmer so it took me ages)

The pdf link you have sent is still really basic. For instance I've been trying to figure out how to make the search stay on the same page, when you search it re-directs to category.php and thus is not part of my cms, so I cant add my own header, navigation and footer.

I tried to add the category page as an include, but I have all my .php files re-written to html so the query string wont work.

by the way the documentation says includes/elements/product_search_box.php but that file doesnt exist its appears to be called just search_box.php

Andy
27-01-08, 20:27
Fair does eshop. You're definitely right about the lack of docs and the lack of use that the current docs are.
but, SW is a commercial project, they don't want every man, his dog and his fleas to run it. So I suspect the docs (which I only read the day I posted above) are intended to be ambiguous to cut the wheat from the chaff (so to speak)

I bet there are 100's of affiliates who seen SW, installed it then got lost before they've even started. TBH & IMHO, these people would be better off using the widgets rather than SW.

You're obviously quite intent on using it, so don't give up if you get stuck. These forums were intended to be a development community, similar to what you see around CMS's like PHPNuke and Joomla. Granted it hasn't quite turned out like that (there's definitely some competition, still no room for paid developers to come nabbing ideas so they can up their price though!) but There's a few of us who post fixes, or ideas, or simply run with other peoples ideas and post the results.

And you don't need to be a PHP programmer as long as you can follow instructions!

Anyhoo..... You've got a prob, lets see if we can eventually find a fix

I gather you know html?

try iFraming your SW into your normal page, give the iframe an id (or is it name? long time since Ive done things like this) and add your search box with the form action to the iframe id (or name??)
that'll be fine for your visitors and search engines will pick up on the framed pages anyway.

eshop600
27-01-08, 21:33
Andy

Thanks for your input, I'm a web designer so my html skills are good. I was thinking I could use a iframe but I only want the search on my home page, the search box itself is fine, its when you submit it, it will clip the search results as I have only allocated a small space for the search.

I could try and create another page in my cms and put the search results in that in an iframe with the height set to 100% or a large pixel value.

I'm just wondering how you would target a page with an iframe and still keep the url strings? In the file constants.inc.php the search page is set to search.php and then it appends the search strings.

I read somewhere you cant pass parameters to an iframe but you could write it dynamically, I'll do a bit of digging to see if I can get the form values and write out the whole iframe statement on the fly and include those values?

Andy
28-01-08, 22:07
Going out on a limb here...........

you CAN pass dynamic values to iframes, sure of it.
ive got this going on with some Ajax, infact, thats all Ajax does, send dynamic values to iframes.

There's a cool script on Dynamic Drive that creates a dynamic iframe with sizes based on the contents size. It's only DHTML, same as HTML except someone else has made it dynamic for you!!

eshop600
28-01-08, 23:08
hhhmm I thought most ajax things such as forms submit back to themselves or rather it doesn't go to another page.

I want my search box on one page, but the results on another page. The trouble is I have all my .php pages in my cms getting re-written to .html to help out on seo, so it looses the values on the url string.

so I need the search parameters going to a .html page with an iframe that contains the search results (php include of shop window page), I need to target that iframe.

the constants.inc page is the page where the search page is set, its set to just search.php, so I somehow need to make it target the html page with the iframe in it.

I'm confusing myself now

eshop600
05-02-08, 22:06
Still cant get this to work, I'v got the search url string going to the search page - the search page is an include on a page within my cms

But now it just shows nothing found, when its not part of my cms it works fine, I'm at a loss now.

Andy
07-02-08, 14:47
Ajax submits back to the server and the javascript just updates the relevant frame/div with the updated info rather than refreshing the whole page.

Anyhoo............

If you're using a CMS, then I would have thought that whatever variable you're sending is being overwritten by the CMS.

for instance, the search form will be sending a $_GET['q'] vaiable (namely the search query. this will get written by SW as $q to the memory at some point.
If your CMS then uses $q for anything, it'll overwrite the $q variable and you'll lose the query.

Im not saying it's definitely doing this to the query, it could be $_GET[c], $_GET[m], $_GET[p] or any other variable that SW uses.

Now, thats not 100% gonna be the cause, there is also a chance that your CMS is using functions for display, in which case you'll have to globalise all the SW variables just above where you have integrated SW.

there's no real way of knowing what the cause is without testing, so first try this:

directly above where you integrate SW add this line:

global $q,$c,$m,$p;

now test, if it works great, if not delete that line and add this in it's place:


echo $_GET['q'].'<--query*'.$_GET['m'].'<--merchantId*'.$_GET['p'].'<--ProductId*'.$_GET['c'].'<--CategoryId*';


that will tell you whats missing. You're only likely to receive a defintite query if anything, but you might get a categoryID or a MerchantID.

if you do, then it's not returning product listings because its searching in a specific category and or merchant.

now, if you're getting just a query but it still displays nothing you'll have to rethink everything.

you could always rebuild your smarty templates to reflect the look of your main site. that would be the easiest option to be fair.

hope this gives you some clues!

eshop600
07-02-08, 23:09
Andy

Thanks for the info, my cms does indeed use the q, so I hacked shop window and changed it to upper case Q. I found this out the other day when messing with googles free site search tool, that broke my cms becuase of the q parameter and someone told me to just change the q to Q and it worked fine.

I didnt use ajax, I actually want the search box on one page, and the search results on a new page not the same page, but not only on a new page, an iframe inside that page. I searched like mad on google and it appears that a search box on one page, can not target a new page with an iframe, or at least not with a url string.

However, yesterday I had a brainwave, rather than integrating into the cms I thought I could integrate the cms into shopwindow, so I found a way to export my cms menu system as a php file, then included that in shopwindow and it works! so now when I add or change menu items in my cms it updates the php file, that in turn, updates shopwindow.

So I'm bloody amazed I managed to get it to work, you can see it at shop-bright (http://www.shop-bright.com) the search is at the top of the page, all it does is submits to the search page.

All I need to do now is make shopwindow look a bit less like shopwindow!

Once again thanks for the help at least I'm learning a bit of php along the way!

kick on
Simon

Andy
15-03-08, 15:19
I knew it! it's always a variable overlap that maesses things up.

I would maybe have changed my q to something alittle more unique, or even SEOable, like "Find" or even "eShop", that way, any other plugins you get won't interfere either.

All I need to do now is make shopwindow look a bit less like shopwindow!
Looking good Simon!! I especially like your flash work, do you do or do you pay for it?

eshop600
17-03-08, 00:07
cheers andy, yea I do the design stuff as I'm a web designer but just do this in my spare time. I just wish the documentation was better for web designers.

Andy
17-03-08, 14:51
It will be one day mate.
The docs for V1 were clearly written by the same people who built the client, so they understand fully whats involved, but forget that us lesser beings don't dream in PHP.
We've been promised better docs for V2, but we'll probably have the same problems.

the best thing for everyone to do is to continue asking questions on here. That way these forums will eventually become a databank of Q&A and ultimately, the resource it's supposed to be.

Tobias
30-09-08, 02:31
Fair does eshop. You're definitely right about the lack of docs and the lack of use that the current docs are.
but, SW is a commercial project, they don't want every man, his dog and his fleas to run it. So I suspect the docs (which I only read the day I posted above) are intended to be ambiguous to cut the wheat from the chaff (so to speak)

Oh, this explains my confusion why I can't find the information I'm looking for :eek: and why ShopWindow Client are so limited.