Hello. I use Phoca Cart extension and want to write couple of ideas and fixes.
Thanks the author for Phoca extensions. They are fine and flexible.
Ideas and fixes
-
- Phoca Newbie
- Posts: 7
- Joined: 18 Aug 2017, 13:29
Ideas and fixes
Last edited by hello.world on 21 Aug 2017, 14:07, edited 1 time in total.
-
- Phoca Newbie
- Posts: 7
- Joined: 18 Aug 2017, 13:29
Re: Ideas and fixes
Search module:
File: administrator\components\com_phocacart\libraries\phocacart\search\search.php
Bug: search doesn't work by couple of words because the same variable $wheres uses inside and outside foreach. Also if variable $in contains spaces then the search ignores search query and shows all producs:
Fixed code:
File: administrator\components\com_phocacart\libraries\phocacart\search\search.php
Bug: search doesn't work by couple of words because the same variable $wheres uses inside and outside foreach. Also if variable $in contains spaces then the search ignores search query and shows all producs:
Fixed code:
Code: Select all
$words = explode(' ', $in);
$wheres = array();
foreach ($words as $word) {
if (!$word = trim($word)) {
continue;
}
$word = $db->quote('%'.$db->escape($word, true).'%', false);
$_wheres = array();
$_wheres[] = 'a.title LIKE '.$word;
$_wheres[] = 'a.alias LIKE '.$word;
$_wheres[] = 'a.metakey LIKE '.$word;
$_wheres[] = 'a.metadesc LIKE '.$word;
$_wheres[] = 'a.description LIKE '.$word;
$wheres[] = implode(' OR ', $_wheres);
}
-
- Phoca Newbie
- Posts: 7
- Joined: 18 Aug 2017, 13:29
Re: Ideas and fixes
Currently I want to have right column only on category page and items page. And don't want to show it on categories listing, product page, checkout page. But all those pages Joomla see as one Phoca Cart component. I propose to make section with text fields in the component configurations: Categories List, Category View, Items Page, Product Page, etc. In those fields can set the position names that need to disable for page type.
Now I did it separately for product page in view-file: components\com_phocacart\views\item\tmpl\default.php
Also I set to registry that it is product page:
So, I can check it in other places and hide or show specific elements on product page.
Now I did it separately for product page in view-file: components\com_phocacart\views\item\tmpl\default.php
Code: Select all
foreach (array('position-3', 'position-6', 'position-8') as $position) {
$modules = JModuleHelper::getModules($position);
foreach ($modules as $module) {
$module->position = 'empty';
}
}
Code: Select all
$registry = \Joomla\Registry\Registry::getInstance('pc');
$registry->def('is_product_page', true);
-
- Phoca Newbie
- Posts: 7
- Joined: 18 Aug 2017, 13:29
Re: Ideas and fixes
Phoca Filter and Search have own page with products (items page). But if open product page and click to the category "Back" button, we get category page instead previous page with chosen filters. My current fix for it:
In file: components\com_phocacart\views\item\tmpl\default.php
After lines:
I added additional check of the previous page:
In file: components\com_phocacart\views\item\tmpl\default.php
After lines:
Code: Select all
$linkUp = JRoute::_(PhocacartRoute::getCategoryRoute($this->category[0]->id, $this->category[0]->alias));
$linkUpText = $this->category[0]->title;
Code: Select all
$current = JUri::getInstance();
$referer = JUri::getInstance();
$referer->parse(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
if ($referer->getHost() === $current->getHost()
&& false !== mb_strpos($referer->getPath(), '/items')
&& ($referer->getVar('s') || $referer->getVar('search'))
) {
$linkUp = JRoute::_($referer);
$linkUpText .= ' - back to search results';
}
-
- Phoca Newbie
- Posts: 7
- Joined: 18 Aug 2017, 13:29
Re: Ideas and fixes
The extension allows to sort groups of specifications on product page. But it doesn't sort the specifications inside group. The order of them can changing on different product pages. Will better to add additional options for every specification:
1) Rows Ordering (by title, by alias, by value, etc.)
2) Show in Filter (Yes or No)
3) Use for Search (Yes or No)
4) Default options that will show during creating new product with specifications. Because currently hard to configure values and aliases of specifications for Product Filter.
The temporary solutions for me are:
1) Specifications are sorted on product page:
In file: components\com_phocacart\views\item\tmpl\default.php
After lines:
I added:
1) Rows Ordering (by title, by alias, by value, etc.)
2) Show in Filter (Yes or No)
3) Use for Search (Yes or No)
4) Default options that will show during creating new product with specifications. Because currently hard to configure values and aliases of specifications for Product Filter.
The temporary solutions for me are:
1) Specifications are sorted on product page:
In file: components\com_phocacart\views\item\tmpl\default.php
After lines:
Code: Select all
foreach($this->t['specifications'] as $k => $v) {
if(isset($v[0]) && $v[0] != '') {
$tabO .= '<h4 class="ph-spec-group-title">'.$v[0].'</h4>';
unset($v[0]);
}
if (!empty($v)) {
Code: Select all
uasort($v, function($a, $b) use ($k) {
if (2 === $k) {
// Specification with ID 2 uses value for sort.
return $a['value'] > $b['value'];
} else {
// Other specifications use title for sort.
return $a['title'] > $b['title'];
}
});
-
- Phoca Newbie
- Posts: 7
- Joined: 18 Aug 2017, 13:29
Re: Ideas and fixes
On the product listing. If enable icons (add to cart, wishlist, compare) that show on hover and disable standard "Add to cart" button, the icon stops working. I use ajax method with popup.
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Ideas and fixes
Hi, thank you very much for your ideas.
1) Search module: I will take a look at it
2) Module position: Maybe it is better to modify the module so it will be not displayed on some views, example:
$app = JFactory::getApplication();
$option = $app->input->get( 'option', '', 'string' );
$view = $app->input->get( 'view', '', 'string' );
if ($option == 'com_phocacart' && ($view == 'items' || $view == 'category')) {
return;
}
3) Back button - in fact it is not a "back button" (history) but "up button" which means going back from product to its category - not going back to your previously displayed page. The problem is, you can get the product view without any history (e.g. from search engine) so you always have the right link to go up: from product to category (product list) to categories (category list)
4) Specifications - not sure if I understand correctly what you exactly mean with "hard to configure values and aliases of specifications for Product Filter"
5) product listing, ajax: which version do you use, do you use 9.1 RC? This should work without having standard button. Do you get any javascript error in console?
Jan
1) Search module: I will take a look at it
2) Module position: Maybe it is better to modify the module so it will be not displayed on some views, example:
$app = JFactory::getApplication();
$option = $app->input->get( 'option', '', 'string' );
$view = $app->input->get( 'view', '', 'string' );
if ($option == 'com_phocacart' && ($view == 'items' || $view == 'category')) {
return;
}
3) Back button - in fact it is not a "back button" (history) but "up button" which means going back from product to its category - not going back to your previously displayed page. The problem is, you can get the product view without any history (e.g. from search engine) so you always have the right link to go up: from product to category (product list) to categories (category list)
4) Specifications - not sure if I understand correctly what you exactly mean with "hard to configure values and aliases of specifications for Product Filter"
5) product listing, ajax: which version do you use, do you use 9.1 RC? This should work without having standard button. Do you get any javascript error in console?
Jan
If you find Phoca extensions useful, please support the project
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Ideas and fixes
Hi,
- Search module - changed in 3.0.0 RC9.2
- Modules - filtering on which page they will be displayed - I think the best way will be to set option in module to display in specific view only (see previous post)
- Disable standard "Add to cart" button - should be fixed in 3.0.0 RC9.2
See:
https://www.phoca.cz/download/category/ ... -component
- Search module - changed in 3.0.0 RC9.2
- Modules - filtering on which page they will be displayed - I think the best way will be to set option in module to display in specific view only (see previous post)
- Disable standard "Add to cart" button - should be fixed in 3.0.0 RC9.2
See:
https://www.phoca.cz/download/category/ ... -component
If you find Phoca extensions useful, please support the project