X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Extra Field Search From product.tpl (https://forum.x-cart.com/showthread.php?t=48320)

mrerotic 07-03-2009 04:47 PM

Re: Extra Field Search From product.tpl
 
Thanks man the problem is that there is a blank one being created after the last one. So if there are actually 3 stars its showing a 4th that is blank.

mrerotic 07-03-2009 05:32 PM

Re: Extra Field Search From product.tpl
 
Also is there anyway to make this actually just search for the exact stars in the extra fields for stars?

gb2world 07-03-2009 05:54 PM

Re: Extra Field Search From product.tpl
 
That is odd. I'm not sure why there would be an extra array element like that. You should see it using the print_r and echo statements in the original php code I gave you. You can always fall back on your php knowledge and add a test for that in the php when creating the $explode_stars array. I would do it in the php if you expect you might have to do more programming for other cases later. You can look at example 2 here to see how to filter the array in php for blanks.

Or. just add another condition in the smarty that won't let anything print if the value is empty - maybe this will work:

Code:

{if $explode_stars[star_name] ne ""}
{if $smarty.section.star_name.index ne 0 }, {/if}<a href="search.php?mode=search&by_title=on&by_shortdescr=on&by_fulldescr=on&by_sku=on&category_main=on &category_extra=on&search_in_subcategories=on&substring={$explode_stars[star_name]}">{$explode_stars[star_name]|replace:' ':'+'}</a>
{/if}


If you can do the search you want on your advanced search page - just use the tip I gave you earlier to get the URL for the link. In advanced search, you can set up the criteria over which you want to search, and it will provide the URL.

mrerotic 07-03-2009 07:31 PM

Re: Extra Field Search From product.tpl
 
awesome thanks man, but in regards to the search now, im trying to search only the extra field "Stars". And I can't select that in my advanced search. Any ideas?

mrerotic 07-03-2009 07:46 PM

Re: Extra Field Search From product.tpl
 
Nevermind got it.. I didnt realize you can turn on extra field searches from the admin area. THX for all your help man.. AWESOME SUPPORT. THX A MILLION

gb2world 07-03-2009 08:05 PM

Re: Extra Field Search From product.tpl
 
you are welcome

mrerotic 07-04-2009 12:08 AM

Re: Extra Field Search From product.tpl
 
gb2world - one last questions totally different. If I want to change how each page title is displayed, I know you can choose from two options in the admin area, but what if I want to make my own custom one for each page? Is there a simple fix for this? Or any ideas?

gb2world 07-04-2009 04:19 AM

Re: Extra Field Search From product.tpl
 
You can search the forum to find answers.
First, make sure you use this tip
Next, select the advanced search under the search in the top menu
next enter:
page AND title AND modify
in the search box
narrow your search by selecting
Storefront Design & Template Editing in 4.2.x
and select Search Now

mrerotic 07-21-2009 11:05 AM

Re: Extra Field Search From product.tpl
 
Thanks gb2world any ideas on how to show all categories that a product is listed in? Same as we did here for the stars, but now I want to show each category.

Thanks in advance :)

gb2world 07-21-2009 01:36 PM

Re: Extra Field Search From product.tpl
 
I doubt that the category information is available to the product page in the default installation. You can use the tip I told you about in post #6 to see the smarty variables that are available to you. If it is there, you can update the template to display the categories.

If the categories are not there - you are going to have to write your own query to get the information and add that to the product.php file. I think you need to query the _products_categories table and find all categories for the productid.

If you understand the code in this thread (the sql query and the php), the concept is similar to what you want to do. You should be able to add an array with the categories to the $products array.


All times are GMT -8. The time now is 04:58 AM.

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