Description of a Related Object
-
- Phoca Member
- Posts: 22
- Joined: 02 Feb 2018, 18:18
Description of a Related Object
Hi again Jan and all users,
This time the problem could be very simple.
I'll make a custom version of "related products" module, but i need to render the descriptions too (of related objects)
but this call doesn't work:
echo '<div class="caption"><h4><a href="'.$link.'">'.$v->title.'</a></h4></div>';
echo '<div class="ph-related-desc">'.$v->description.'</div>';
echo '<div>';
echo '<a href="'.$link.'" class="btn btn-primary btn-sm ph-btn" role="button"><span class="glyphicon glyphicon-search"></span> '.JText::_('COM_PHOCACART_VIEW_PRODUCT').'</a>';
echo '</div>';
etc.etc.
$link is original and it's ok
$v->title is original and it's ok
$v->description added by mine and doesn't work
What did i miss?
This time the problem could be very simple.
I'll make a custom version of "related products" module, but i need to render the descriptions too (of related objects)
but this call doesn't work:
echo '<div class="caption"><h4><a href="'.$link.'">'.$v->title.'</a></h4></div>';
echo '<div class="ph-related-desc">'.$v->description.'</div>';
echo '<div>';
echo '<a href="'.$link.'" class="btn btn-primary btn-sm ph-btn" role="button"><span class="glyphicon glyphicon-search"></span> '.JText::_('COM_PHOCACART_VIEW_PRODUCT').'</a>';
echo '</div>';
etc.etc.
$link is original and it's ok
$v->title is original and it's ok
$v->description added by mine and doesn't work
What did i miss?
Tags:
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Description of a Related Object
So this seems like the description field is not loaded by database, I will add this to the next version. For now you can customize it here:
administrator\components\com_phocacart\libraries\phocacart\related\related.php
line 85
FROM:
TO:
line 127
FROM:
TO:
Jan
administrator\components\com_phocacart\libraries\phocacart\related\related.php
line 85
FROM:
Code: Select all
$query = ' SELECT DISTINCT a.id as id, a.title as title, a.image as image, a.alias as alias,'
Code: Select all
$query = ' SELECT DISTINCT a.id as id, a.title as title, a.image as image, a.alias as alias, a.description, a.description_long,'
FROM:
Code: Select all
$query .= ' GROUP BY a.id, a.title, a.alias, a.image';
Code: Select all
$query .= ' GROUP BY a.id, a.title, a.alias, a.image, a.description, a.description_long';
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 22
- Joined: 02 Feb 2018, 18:18
Re: Description of a Related Object
Ok. Thank to you it's solved.
Please allow me some corrections:
I've found the query "SELECT" (without DISTINCT) at line 82 not 85 and the correct syntax is: , a.description as description,'
I've found the query "GROUP" at line 112 not 127
Thank you so much for your precious help.
Please allow me some corrections:
I've found the query "SELECT" (without DISTINCT) at line 82 not 85 and the correct syntax is: , a.description as description,'
I've found the query "GROUP" at line 112 not 127
Thank you so much for your precious help.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Description of a Related Object
Ok
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 22
- Joined: 02 Feb 2018, 18:18
Re: Description of a Related Object
I don't know how to add the "Solved" tag to this forum
-
- Phoca Member
- Posts: 22
- Joined: 02 Feb 2018, 18:18
Re: Description of a Related Object
Hi again ...Jan wrote: ↑18 Mar 2018, 14:43 So this seems like the description field is not loaded by database, I will add this to the next version. For now you can customize it here:
administrator\components\com_phocacart\libraries\phocacart\related\related.php
line 85
FROM:TO:Code: Select all
$query = ' SELECT DISTINCT a.id as id, a.title as title, a.image as image, a.alias as alias,'
line 127Code: Select all
$query = ' SELECT DISTINCT a.id as id, a.title as title, a.image as image, a.alias as alias, a.description, a.description_long,'
FROM:TO:Code: Select all
$query .= ' GROUP BY a.id, a.title, a.alias, a.image';
JanCode: Select all
$query .= ' GROUP BY a.id, a.title, a.alias, a.image, a.description, a.description_long';
and if I want to do the same on a global items view (Products View (Product list layout))? I know how and where to modify the override file on frontend but didn't to read datas from database (like some week ago, with related object)
The question is: <<Where can i find the file that interrogate the database for items compilation?>>
I've found :
administrator/components/com_phocacart/libraries/phocacart/product/product.php
and
components/com_phocacart/models/item.php
but before any try i'd like to read your reply.
Sorry for the patience i'm asking. I've almost finished.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Description of a Related Object
Hi, the model item loads data for item view (product view) and the product.php in libraries folder load data for items/category view when page is displayed by ajax.
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 22
- Joined: 02 Feb 2018, 18:18
Re: Description of a Related Object
Damn, I can not make it.
I 'd like to import these datas (always there) on the grid view of all products view:
serial_number, upc, ean, jan, isbn, sku, mpn.
on row 500 (about) on the Grid render of the override of com_phocacart/items/default.php (watch out: ITEMS and not ITEM)
If i try to call $v->sku, for example it doesn't stamps nothing.
Can you reveal me where is that query? I can not found it.
Thank you.
I 'd like to import these datas (always there) on the grid view of all products view:
serial_number, upc, ean, jan, isbn, sku, mpn.
on row 500 (about) on the Grid render of the override of com_phocacart/items/default.php (watch out: ITEMS and not ITEM)
If i try to call $v->sku, for example it doesn't stamps nothing.
Can you reveal me where is that query? I can not found it.
Thank you.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Description of a Related Object
In such case you need to change the model of items/category view, to load all the columns: serial_number, upc, ean, jan, isbn, sku, mpn
components\com_phocacart\models\items.php
components\com_phocacart\models\category.php
search for $columns variable which includes the asked columns
Jan
components\com_phocacart\models\items.php
components\com_phocacart\models\category.php
search for $columns variable which includes the asked columns
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 22
- Joined: 02 Feb 2018, 18:18
Re: Description of a Related Object
SUPER SOLVED!!!
Thank you so much Jan. Very Precious all the time.
a little correction:
OK for components\com_phocacart\models\items.php
BUT NOT components\com_phocacart\models\category.php
for my case the right file was: administrator\components\com_phocacart\libraries\phocacart\product\product.php
at row 290: added to $columns e $groupsFull = a.mpn as mpn, a.isbn as isbn, a.ean as ean, a.jan as jan, a.upc As upc, a.serial_number AS serial_number, a.sku AS sku,
Thank you so much Jan. Very Precious all the time.
a little correction:
OK for components\com_phocacart\models\items.php
BUT NOT components\com_phocacart\models\category.php
for my case the right file was: administrator\components\com_phocacart\libraries\phocacart\product\product.php
at row 290: added to $columns e $groupsFull = a.mpn as mpn, a.isbn as isbn, a.ean as ean, a.jan as jan, a.upc As upc, a.serial_number AS serial_number, a.sku AS sku,