- Posts: 54
- Thank you received: 0
Get The Catgories of Products In Cart
- eileensemporium
-
Topic Author
- Offline
Less
More
9 years 8 months ago #259212
by eileensemporium
Get The Catgories of Products In Cart was created by eileensemporium
-- HikaShop version -- : HikaShop Business 2.6.4 [1610121552]
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.4
I would like to display a message to customers if products from a certain category added to the cart, is this possible in PHP (the products may be in more than one category)?
Thanks
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.4
I would like to display a message to customers if products from a certain category added to the cart, is this possible in PHP (the products may be in more than one category)?
Thanks
Please Log in or Create an account to join the conversation.
9 years 8 months ago #259214
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Get The Catgories of Products In Cart
Hi,
Where and when you do want to display that message ?
Regards,
Where and when you do want to display that message ?
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- eileensemporium
-
Topic Author
- Offline
Less
More
- Posts: 54
- Thank you received: 0
9 years 8 months ago - 9 years 8 months ago #259253
by eileensemporium
Replied by eileensemporium on topic Get The Catgories of Products In Cart
In a PHP module (Metamod) as I just want to display a message to customers
Could also do with the volume of the combined products too
Could also do with the volume of the combined products too
Last edit: 9 years 8 months ago by eileensemporium.
Please Log in or Create an account to join the conversation.
9 years 8 months ago #259305
by nicolas
Replied by nicolas on topic Get The Catgories of Products In Cart
Hi,
You'll have to get the products of the current cart with such code:
You'll have to get the products of the current cart with such code:
Code:
<?php
if(!defined('DS')) define('DS',DIRECTORY_SEPARATOR);
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'):
$class = hikashop_get('class.cart');
$cart = $class->loadFullCart();
// in $cart->products you'll find an array of all the products in the cart
// then you'll have to do a MySQL query on the hiksahop_product_category table in order to check if there are entries with these products' ids and the id of the category you want to check them against
Please Log in or Create an account to join the conversation.
- eileensemporium
-
Topic Author
- Offline
Less
More
- Posts: 54
- Thank you received: 0
9 years 8 months ago #259357
by eileensemporium
Replied by eileensemporium on topic Get The Catgories of Products In Cart
Thanks
Is the customer's country available too so that I can hide the message depending on the delivery country?
Is the customer's country available too so that I can hide the message depending on the delivery country?
Please Log in or Create an account to join the conversation.
9 years 8 months ago #259364
by nicolas
Replied by nicolas on topic Get The Catgories of Products In Cart
Hi,
You can use such code:
$id = hikashop_getZone();
That will give you the id of the zone of the user. If you have the address_state custom field enabled, it will give you the id of the state selected, otherwise, it will be the id of the country.
And you can look up the countries/states in the table hikashop_zone in the database and their links in the hikashop_zone_link table.
You can use such code:
$id = hikashop_getZone();
That will give you the id of the zone of the user. If you have the address_state custom field enabled, it will give you the id of the state selected, otherwise, it will be the id of the country.
And you can look up the countries/states in the table hikashop_zone in the database and their links in the hikashop_zone_link table.
The following user(s) said Thank You: eileensemporium
Please Log in or Create an account to join the conversation.
Time to create page: 0.210 seconds