X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   V4 - auto search using vars in url (https://forum.x-cart.com/showthread.php?t=13367)

mmaner 04-12-2005 07:12 AM

V4 - auto search using vars in url
 
I used to be able to use this link to automate a search by product code...

http://www.wittrans.net/ecart/customer/search.php?substring=24070

24070 being the product code.

I searched through the forums and found that this has essentially been disable in v4. Is there a work around or anything.

I have an exploded view of a Product that is made up of multiple parts. Each of those parts is available as Used, New, Remanufactured, blah blah blah. The part number is the same for all versions it just has a U, R or an A infront of the part number. I had previosly assumed that I could do an auto search based on the part number and get all the versions. Now it turns out that I can't.

I am willing to pay for this functionality. Please IM me with the pricining info.

thanks

Jon 04-12-2005 08:39 AM

You have to either use a POST to your search.php or reformat the search.php to use a GET instead.

mmaner 04-12-2005 08:46 AM

wow, I wish I was that good. Unfortunately I am not.

Essentially all I want to do is creat a link on my image map that do an auto search through the database & return the results as a product(s) listing.

I would rather find a way to use a POST so as to keep future upgrade paths available, but I don't have a clue what the syntax would be.

If I can't use a POST is it possible to replace the 4.0.13 version of 'search.php' with an older version so as to use a GET?

Jon 04-12-2005 09:13 AM

Not sure if just using an older version would work, you could always backup and try it, though I wouldn't expect it to work.

If you look at your search page and view source, you can pull the form from it and alter it to use on your page.

If you'd like a quote on doing it please PM me your page URL with what exactly your trying to do, and if you use MSN Messenger send me your handle so that we can speak directly if needed.

mmaner 04-12-2005 11:32 AM

I received this response from X-Cart... I works great :)

1. Create 'auto_search.php' file in the '<xcart_root_dir>' folder.

2. Open this file and add following code :

Code:

---
<HTML>
<BODY onLoad="document.process.submit();">
<TABLE width=100% height=100%>
<TR><TD align=center valign=middle>
<FORM action="search.php" method="POST" name="process">
<INPUT type="hidden" name="simple_search" value="Y">
<INPUT type="hidden" name="mode" value="search">
<INPUT type="hidden" name="posted_data[by_title]" value="Y">
<INPUT type="hidden" name="posted_data[by_shortdescr]" value="Y">
<INPUT type="hidden" name="posted_data[by_fulldescr]" value="Y">
<INPUT type="hidden" name="posted_data[substring]" size="16" value="<? echo $substr ?>">
<INPUT type="submit" name="submit1" value="JavaScript is disabled in your browser. Please press this button.">

Please wait while searching...</TD>
</FORM>
</TR>
</TABLE>
</BODY>
</HTML>
---


3. After that you will be able to use links like :

http://www.website.net/xcart/auto_search.php?substr=555555

sstillwell@aerostich.com 04-13-2005 10:27 AM

wow, cool! I have implemented this but added a few polishing touches.

1. I don't want the "Javascript Disabled" showing when that is not the case.
2. I want the button only present if JS is indeed disabled.
3. I don't want the "Please wait" text if JS is disabled and they have to hit the submit button.
4. I also changed the URL variable to q (after the great Google)
5. Added the proper way to get php variables from an HTML GET string.

So here is my polished version

Code:

<?php
$substr = $_GET['q'];
?>
<HTML>
<BODY onLoad="document.process.submit();">
<TABLE width="100%" height="100%">
<TR>
<TD align="center" valign="middle" />
        <FORM action="search.php" method="POST" name="process" />
        <INPUT type="hidden" name="simple_search" value="Y" />
        <INPUT type="hidden" name="mode" value="search" />
        <INPUT type="hidden" name="posted_data[by_title]" value="Y" />
        <INPUT type="hidden" name="posted_data[by_shortdescr]" value="Y" />
        <INPUT type="hidden" name="posted_data[by_fulldescr]" value="Y" />
        <script>document.write('Please wait while searching...') </script>
        <noscript>
        <h3>JavaScript is disabled in your browser.</h3>
        <INPUT type="submit" name="submit1" value="Continue >>" />
        </noscript>
        <INPUT type="hidden" name="posted_data[substring]" size="16" value="<?php echo $substr ?>">
        </FORM>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>


mmaner 04-13-2005 10:36 AM

sweet bro :)

I just implemented it, and it rocks.

PhilJ 04-14-2005 01:59 PM

Excellent, well done.

anandat 04-15-2005 06:55 AM

Very nice work indeed sstillwell@aerostich.com :D
Thanks.

mmaner 04-15-2005 09:05 AM

here's a new one for ya...

I have had a ton of problems out of the BMY Add-On, I'm wondering if I can't do the same thing with this Auto Search.

Somthing like: http://www.website.net/xcart/auto_search.php?substr=ford,aod,hard_parts

Ford= Brand
AOD= Model
Hard Parts=Type

Any ideas would be appreciated :)


All times are GMT -8. The time now is 12:09 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.