- Posts: 57
- Thank you received: 4
CHECKOUT - Get category data of the entry products
- rfernandes
-
Topic Author
- Offline
Less
More
11 years 10 months ago - 11 years 10 months ago #187357
by rfernandes
CHECKOUT - Get category data of the entry products was created by rfernandes
Hi,
Can you help me please?
Hi need to get all the information of the categories of products inserted to use (for example) category namekey, category image or category name with the product information.
Can you help me how can I acess this data?
Hi have tried to access in "$this->element", "$this->rows", "$row", "$this->...") and don't find nothing about category.
Can you help me please?
Hi need to get all the information of the categories of products inserted to use (for example) category namekey, category image or category name with the product information.
Can you help me how can I acess this data?
Hi have tried to access in "$this->element", "$this->rows", "$row", "$this->...") and don't find nothing about category.
Last edit: 11 years 10 months ago by rfernandes.
Please Log in or Create an account to join the conversation.
11 years 10 months ago #187363
by nicolas
Replied by nicolas on topic CHECKOUT - Get category data of the entry products
Hi,
On which page/view/file do you need to get that data ?
On which page/view/file do you need to get that data ?
Please Log in or Create an account to join the conversation.
- rfernandes
-
Topic Author
- Offline
Less
More
- Posts: 57
- Thank you received: 4
11 years 10 months ago #187471
by rfernandes
Replied by rfernandes on topic CHECKOUT - Get category data of the entry products
In checkout page. More exact in cart.php to show the category image with the product image.
Please Log in or Create an account to join the conversation.
11 years 10 months ago #187532
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic CHECKOUT - Get category data of the entry products
Hi,
Because a product can have several categories, this information is not load by default (in the listings).
So you need to load the categories of the listed product (using a SQL query).
Here some code from the product show
In your case you have to handle several product id depending the listing you have.
Regards,
Because a product can have several categories, this information is not load by default (in the listings).
So you need to load the categories of the listed product (using a SQL query).
Here some code from the product show
Code:
$query = 'SELECT b.* FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('category').' AS b ON a.category_id = b.category_id WHERE a.product_id = '.(int)$prod->product_id.' ORDER BY a.product_category_id ASC';
$database->setQuery($query);
$categories = $database->loadObjectList();
$this->assignRef('categories',$categories);
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: rfernandes
Please Log in or Create an account to join the conversation.
- rfernandes
-
Topic Author
- Offline
Less
More
- Posts: 57
- Thank you received: 4
11 years 10 months ago #187628
by rfernandes
Replied by rfernandes on topic CHECKOUT - Get category data of the entry products
Thanks.
But for example, the product have a variable for default image, that image that you define that will show if you don't have a product image.
Maybe if we set that or if we create a session variable we can get after this variable.
For example, $variablename[$idproduct] = "xpto.jpg".
If we define an array where the idproduct define the position of the array and set there the image access maybe it will works.
What you think about that?
But for example, the product have a variable for default image, that image that you define that will show if you don't have a product image.
Maybe if we set that or if we create a session variable we can get after this variable.
For example, $variablename[$idproduct] = "xpto.jpg".
If we define an array where the idproduct define the position of the array and set there the image access maybe it will works.
What you think about that?
Please Log in or Create an account to join the conversation.
11 years 10 months ago #187715
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic CHECKOUT - Get category data of the entry products
Hi,
I am sorry but I don't understand your last message regarding the previous discussion.
Regards,
I am sorry but I don't understand your last message regarding the previous discussion.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- rfernandes
-
Topic Author
- Offline
Less
More
- Posts: 57
- Thank you received: 4
11 years 10 months ago #187788
by rfernandes
Replied by rfernandes on topic CHECKOUT - Get category data of the entry products
Hi,
I have tried to said that maybe if we works with session variables maybe is better, but isn't because if we make a logout and return to the cart we don't have session variables so we don't have fields to override.
I have tried to said that maybe if we works with session variables maybe is better, but isn't because if we make a logout and return to the cart we don't have session variables so we don't have fields to override.
Please Log in or Create an account to join the conversation.
11 years 10 months ago #187817
by nicolas
Replied by nicolas on topic CHECKOUT - Get category data of the entry products
Hi,
You could indeed use $_SESSION to do that, but it's not perfect. If the user logs to his account and already has a cart for it and goes directly to the checkout, the $_SESSION array won't contain any product data and you won't be able to use the data coming from the product page.
Ideally, it would be safer to load again the data you need where you need it.
You could indeed use $_SESSION to do that, but it's not perfect. If the user logs to his account and already has a cart for it and goes directly to the checkout, the $_SESSION array won't contain any product data and you won't be able to use the data coming from the product page.
Ideally, it would be safer to load again the data you need where you need it.
The following user(s) said Thank You: rfernandes
Please Log in or Create an account to join the conversation.
- rfernandes
-
Topic Author
- Offline
Less
More
- Posts: 57
- Thank you received: 4
11 years 10 months ago #187943
by rfernandes
Replied by rfernandes on topic CHECKOUT - Get category data of the entry products
Yes it's true.
I have saw this sittuation yesterday before report the last post.
Thanks for your attention I hope that this topic can help anothers users.
I have saw this sittuation yesterday before report the last post.
Thanks for your attention I hope that this topic can help anothers users.
Please Log in or Create an account to join the conversation.
Time to create page: 0.060 seconds