See product in Add to Cart Modal - How?
- nowherenowhere
-
Topic Author
- Offline
I've been busy working on a few ecommerce sites lately ad Hika is the best! I just love this component. Supprt is outstanding and its such a mind-leap from the other stuff...
But I have a small issue I really need some help with - though if I can figure it out before I get a reply I'll let everyone know.
What I want is for the product which has been "Add to Cart" to display in the modal window just below the 2 buttons (Notices) So I know I'm looking in the notices.php under checkout... Quesiton is - what code to I put and where?
Thank you
Brett
Believe in Better
Please Log in or Create an account to join the conversation.
Actually, in the popup, you don't know which product was added.
All you can do is load the cart and get the name of the product which was added the latest in the cart. Something like that:
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
Ah yeah I see how it's working and I've added the code - I can now see the product name... How can I pull more info from the cart though - it would be great if I could get a picture of the item, along with the name and the price - is that possible? I've tried grabbing some of the code from view > checkout > cart but its just breaking the thing - probably because my PHP syntax is poor/ faulty
Believe in Better
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
I think I'm doing something wrong here... From what I can see I replace the original snippet from foreach... but then nothing is being echoed back:
<?php
$class = hikashop_get('class.cart');
$cart = $class->loadFullCart();
$max = null;
foreach($cart->products as $product){
if($product->product_id!= $max->product_id) continue;
echo $product->prices[0]->price_value;
$image = reset($row->images);
$height = $this->config->get('thumbnail_y');
echo $this->image->display($image->file_path,true,$image->file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"');
}
?>
She's not working....
Believe in Better
Please Log in or Create an account to join the conversation.
See, the $max variable which is used in the second piece of code I gave is initialized in the first piece of code I gave.
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
Unfortunately that also has some issues >
Take 1 >
<?php
$class = hikashop_get('class.cart');
$cart = $class->loadFullCart();
$max = null;
foreach($cart->products as $product){
if($product->cart_product_modified>@$max->cart_product_modified){
$max = $product;
}
}
if($max){
$class = hikashop_get('class.product');
$product = $class->get($max->product_id);
echo $product->product_name;
}
foreach($cart->products as $product){
if($product->product_id!= $max->product_id) continue;
echo $product->prices[0]->price_value;
$image = reset($row->images);
$height = $this->config->get('thumbnail_y');
echo $this->image->display($image->file_path,true,$image->file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"');
}
?>
Errors:
Strappy Chick2100
Warning: reset() expects parameter 1 to be array, null given in /home/content/97/9350797/html/templates/ds_2/html/com_hikashop/checkout/notice.php on line 44
Fatal error: Call to a member function display() on a non-object in /home/content/97/9350797/html/templates/ds_2/html/com_hikashop/checkout/notice.php on line 46
Take 2 >
<?php
$class = hikashop_get('class.cart');
$cart = $class->loadFullCart();
$max = null;
foreach($cart->products as $product){
if($product->cart_product_modified>@$max->cart_product_modified){
$max = $product;
}
}
if($max){
$class = hikashop_get('class.product');
$product = $class->get($max->product_id);
echo $product->product_name;
foreach($cart->products as $product){
if($product->product_id!= $max->product_id) continue;
echo $product->prices[0]->price_value;
$image = reset($row->images);
$height = $this->config->get('thumbnail_y');
echo $this->image->display($image->file_path,true,$image->file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"');
}
}
?>
Errors:
Strappy Chick2400
Warning: reset() expects parameter 1 to be array, null given in /home/content/97/9350797/html/templates/ds_2/html/com_hikashop/checkout/notice.php on line 43
Fatal error: Call to a member function display() on a non-object in /home/content/97/9350797/html/templates/ds_2/html/com_hikashop/checkout/notice.php on line 45
I dont know whats going on here....
Believe in Better
Please Log in or Create an account to join the conversation.
$image = reset($row->images);
should be:
$image = reset($product->images);
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
Here is my code:
<?php
$class = hikashop_get('class.cart');
$cart = $class->loadFullCart();
$max = null;
foreach($cart->products as $product){
if($product->cart_product_modified>@$max->cart_product_modified){
$max = $product;
}
}
if($max){
$class = hikashop_get('class.product');
$product = $class->get($max->product_id);
echo $product->product_name;
}
foreach($cart->products as $product){
if($product->product_id!= $max->product_id) continue;
echo $product->prices[0]->price_value;
$image = reset($product->images);
$height = $this->config->get('thumbnail_y');
echo $this->image->display($image->file_path,true,$image->file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"');
}
?>
here is the error:
Fatal error: Call to a member function display() on a non-object in /home/content/97/9350797/html/templates/ds_2/html/com_hikashop/checkout/notice.php on line 46
Although on the positive side it is now showing price total I think
Believe in Better
Please Log in or Create an account to join the conversation.
$this->image = hikashop_get('helper.image');
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
This is great I have it working nicely now - thank you. here is the working code so far:
I do still have one issue though... If I add a product with options ie. its a shoe site and you could select a black or grey or white shoe - when I add it - in the modal it has a bit of a freak out with the price... please see here > heelcrush.com/collection.html (Click Modern Crimp "BUY ME") Select a size and "BUY ME" in the modal that pops up the price is now crazy >> Price: 300.00000
Please help me
Believe in Better
Please Log in or Create an account to join the conversation.
echo $product->prices[0]->price_value;
to:
$class = hikashop_get('class.currency');
echo $class->format($product->prices[0]->price_value,$product->prices[0]->price_currency_id);
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
I get this error:
Parse error: syntax error, unexpected T_CLASS in /home/content/97/9350797/html/templates/ds_2/html/com_hikashop/checkout/notice.php on line 48
Not sure what this all means is it because there are 2 variables called $class
Believe in Better
Please Log in or Create an account to join the conversation.
$class = hikashop_get('class.currency');
echo $class->format($product->prices[0]->price_value,$product->prices[0]->price_currency_id);
Please Log in or Create an account to join the conversation.
- nowherenowhere
-
Topic Author
- Offline
Here is the code for all the other peeps who need it >>
Believe in Better
Please Log in or Create an account to join the conversation.
- Posts: 2
- Thank you received: 0
Is it possible to pass to the notice even the related products to the added one?
I can pass a module position to the popup but if i try to add related items module to this doesnot work (custom html in the module shows, so the module position added i functional)
Please Log in or Create an account to join the conversation.
Do you have an error displayed ?
You can enable the Joomla debug mode, and set the error reporting to maximum to see from where the problem come.
Please Log in or Create an account to join the conversation.