- Posts: 21
- Thank you received: 0
get picture of product
11 years 6 months ago #193840
by mcambou1
get picture of product was created by mcambou1
-- HikaShop version -- : 2.3.5
hy ,
i want display picture and link to a product
the object $product dont have this information
$productClass = hikashop_get('class.product');
$product=$productClass->get($product_id);
www.hikashop.com/support/support/documen...umentation.html#code
thanks for help
hy ,
i want display picture and link to a product
the object $product dont have this information
$productClass = hikashop_get('class.product');
$product=$productClass->get($product_id);
www.hikashop.com/support/support/documen...umentation.html#code
thanks for help
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
11 years 6 months ago #193873
by Mohamed Thelji
Replied by Mohamed Thelji on topic get picture of product
Hello,
Can you give us more information about what do you want to do, like where do you exactly want to display it ?
Thanks.
Can you give us more information about what do you want to do, like where do you exactly want to display it ?
Thanks.
Please Log in or Create an account to join the conversation.
11 years 6 months ago #194009
by mcambou1
Replied by mcambou1 on topic get picture of product
hy
i want display it in my component , so i code a function in this way :
function get_image_product($id) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('file_path'));
$query->from($db->quoteName('#__hikashop_file'));
$query->where($db->quoteName('file_ref_id') . ' = ' . $id);
$db->setQuery($query);
return $db->loadObject()->file_path;
}
if you have a better and a cleaner way , thank you to tell me how .
i want display it in my component , so i code a function in this way :
function get_image_product($id) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('file_path'));
$query->from($db->quoteName('#__hikashop_file'));
$query->where($db->quoteName('file_ref_id') . ' = ' . $id);
$db->setQuery($query);
return $db->loadObject()->file_path;
}
if you have a better and a cleaner way , thank you to tell me how .
Please Log in or Create an account to join the conversation.
11 years 6 months ago #194019
by Xavier
Replied by Xavier on topic get picture of product
Hi,
You code is correct, what is missing is the folder path, you can get it thanks to:
To get all the product data, you can too use the code:
You code is correct, what is missing is the folder path, you can get it thanks to:
Code:
$fileClass = hikashop_get('class.file');
$folderPath = $fileClass->get('image');
To get all the product data, you can too use the code:
Code:
$productClass = hikashop_get('class.product');
$productClass->getProducts($id);
$fullProduct = $productClass->products[$id];
The following user(s) said Thank You: mcambou1
Please Log in or Create an account to join the conversation.
11 years 6 months ago #194619
by mcambou1
Replied by mcambou1 on topic get picture of product
hy
one last question , how can i get the add to cart button ?
thanks for help
one last question , how can i get the add to cart button ?
thanks for help
Please Log in or Create an account to join the conversation.
11 years 6 months ago #194622
by Xavier
Replied by Xavier on topic get picture of product
Hi,
Whn you are in the backend, in Product, edit a product, then in the toolbar you will see a button "add to cart html", click on it.
This will display the code to add a product to the cart directly, so you can use this code and make it more dynamic to adapt it for each products.
Whn you are in the backend, in Product, edit a product, then in the toolbar you will see a button "add to cart html", click on it.
This will display the code to add a product to the cart directly, so you can use this code and make it more dynamic to adapt it for each products.
The following user(s) said Thank You: mcambou1
Please Log in or Create an account to join the conversation.
11 years 6 months ago #194960
by mcambou1
Replied by mcambou1 on topic get picture of product
awesome !
thanks for help
thanks for help
Please Log in or Create an account to join the conversation.
Time to create page: 0.226 seconds