Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Default Search Module / Tutorial

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 08-01-2016, 09:25 AM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Default Search Module / Tutorial

I originally asked this question a few months ago.
Changing the default search parameter from 'any words' to 'all words'

I see now that this has been added as a module tutorial/walk-through in the developer section.

I followed it along to the best of my understanding but when I redeployed the store, it got hung op on Step 6 of 13.

I am wondering if I did something wrong and if someone can help me out here.

I created a simple module as outlined here:
http://devs.x-cart.com/en/getting_started/step_1_-_creating_simplest_module.html

After creating the module I uploaded it and redeployed the store. The empty module is showing up just fine.

Now, this next series of steps is confusing me:
http://devs.x-cart.com/en/customization_examples/resetting_the_search_parameter_from_any_word_to_al l_words.html

Step 2. Says "In this module, add a new class:"

Do I add this at the bottom of the simple module file (Main.php), just after this chunk of code...
Code:
public static function getDescription() { return 'Resets the search parameter from any word to all words'; } }
?
__________________
X-Cart Business 5.4.1.29
Reply With Quote
  #2  
Old 08-01-2016, 09:44 AM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Re: Default Search Module / Tutorial

I don't know if this was the issue but I did find an error in syntax here:
http://devs.x-cart.com/en/customization_examples/resetting_the_search_parameter_from_any_word_to_al l_words.html
Code:
namespace XLite\Module\<YOUR-DEVELOPER-ID>/<YOUR-MODULE-ID>\View\Form\Product\Search\Customer; class SimpleForm extends \XLite\View\Form\Product\Search\Customer\SimpleForm implements \XLite\Base\IDecorator { protected function getDefaultParams() { $params = parent::getDefaultParams(); $params[\XLite\View\ItemsList\Product\Customer\Search::PARAM_INCLUDING] = \XLite\Model\Repo\Product::INCLUDING_ALL; return $params; } }

The bold & underlined forward slash between <YOUR-DEVELOPER-ID>/<YOUR-MODULE-ID> should be a back slash, no?
__________________
X-Cart Business 5.4.1.29
Reply With Quote
  #3  
Old 08-01-2016, 09:47 AM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Re: Default Search Module / Tutorial

Also, this new Main.php file is simply in a directory I created called "DefaultSearch"
/classes/XLite/Module/Brando/DefaultSearch

If that is where the file is, should the namespace simply be
namespace XLite\Module\Brando\DefaultSearch;

or does it have to be namespace XLite\Module\Brando\DefaultSearch\View\Form\Produc t\Search\Customer;
as shown in the walk-through?
__________________
X-Cart Business 5.4.1.29
Reply With Quote
  #4  
Old 08-01-2016, 09:00 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Default Search Module / Tutorial

Quote:
Originally Posted by BrandonLR
I followed it along to the best of my understanding but when I redeployed the store, it got hung op on Step 6 of 13.
Did it happen only once?

Quote:
Originally Posted by BrandonLR
Step 2. Says "In this module, add a new class:"
Do I add this at the bottom of the simple module file (Main.php), just after this chunk of code...?

No, you should create the following new file and enter its contents as per the documentation:
classes/XLite/Module/YOUR-DEVELOPER-ID/YOUR-MODULE-ID/View/Form/Product/Search/Customer/SimpleForm.php

Quote:
Originally Posted by BrandonLR
The bold & underlined forward slash between <YOUR-DEVELOPER-ID>/<YOUR-MODULE-ID> should be a back slash, no?

Yes, it should be a back slash. Thank you for finding this!

Quote:
Originally Posted by BrandonLR
Also, this new Main.php file is simply in a directory I created called "DefaultSearch"
/classes/XLite/Module/Brando/DefaultSearch

If that is where the file is, should the namespace simply be
namespace XLite\Module\Brando\DefaultSearch;

or does it have to be namespace XLite\Module\Brando\DefaultSearch\View\Form\Produc t\Search\Customer;
as shown in the walk-through?


The namespace should match the path to the file.

For "classes/XLite/Module/Brando/DefaultSearch/Main.php" the namespace should be "XLite\Module\Brando\DefaultSearch", and the class name should be "Main".

For "classes/XLite/Module/Brando/DefaultSearch/View/Form/Product/Search/Customer/SimpleForm.php" the namespace should be "XLite\Module\Brando\DefaultSearch\View\Form\Produ ct\Search\Customer", and the class name should be "SimpleForm".
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
BrandonLR (08-01-2016)
  #5  
Old 08-01-2016, 09:07 PM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Re: Default Search Module / Tutorial

Quote:
Originally Posted by qualiteam
No, you should create the following new file and enter its contents as per the documentation:
classes/XLite/Module/YOUR-DEVELOPER-ID/YOUR-MODULE-ID/View/Form/Product/Search/Customer/SimpleForm.php


The documentation only says
Code:
namespace XLite\Module\<YOUR-DEVELOPER-ID>/<YOUR-MODULE-ID>\View\Form\Product\Search\Customer; class SimpleForm extends \XLite\View\Form\Product\Search\Customer\SimpleForm implements \XLite\Base\IDecorator { protected function getDefaultParams() { $params = parent::getDefaultParams(); $params[\XLite\View\ItemsList\Product\Customer\Search::PARAM_INCLUDING] = \XLite\Model\Repo\Product::INCLUDING_ALL; return $params; } }

Could you please update the documentation with the needed corrections?
http://devs.x-cart.com/en/customization_examples/resetting_the_search_parameter_from_any_word_to_al l_words.html
__________________
X-Cart Business 5.4.1.29
Reply With Quote
  #6  
Old 08-02-2016, 07:59 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Default Search Module / Tutorial

Quote:
Originally Posted by BrandonLR
Could you please update the documentation with the needed corrections?

I've asked the person who wrote the article to tweak it.
Thank you!
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
BrandonLR (08-03-2016)
  #7  
Old 08-03-2016, 07:34 AM
 
BrandonLR BrandonLR is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 161
 

Default Re: Default Search Module / Tutorial

Quote:
Originally Posted by qualiteam
I've asked the person who wrote the article to tweak it.
Thank you!

Thank you. I also figured it out and got it to work. I appreciate your help and clarity.

I am curious though- why so many empty directories?
__________________
X-Cart Business 5.4.1.29
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:48 PM.

   

 
X-Cart forums © 2001-2020