Cart Module Questions

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #95549

1.-Is it possible to include images of the product ordered in the cart module?
2.- Is it possible to display the cart in a pop up window? just have an icon your cart an when they click on it displays the cart in a pop up.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #95609

Hi,

You have to edit the view "product / cart" to display the images in the cart. The images are not loaded by default, but you can use a little request to have them.
Like on this topic: www.hikashop.com/fr/forum/5-support-en-f...-affiche-images.html

It's possible but will require too some custom code.
On the link, you will have to load the view "product / cart" and add at the end of the url "&tmpl=component".

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #95613

cant understand french i suppose that in the last two lines is the code i have to insert?
2.- is it similar to when you create a popup with checkout once you choose an article or its more difficult than that?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #95644

1. You need something like:

$db = JFactory::getDBO();
						$query = 'SELECT `file_path` FROM `#__hikashop_file` WHERE file_ref_id = "'.(int)$cart->product_id.'" LIMIT 1';
						$db->setQuery($query);
						$image = $db->loadResult();
To load the first image of the product. Thanks to change the var to the corresponding one in the view "product / cart".
Then you need to add the image in the cart table, you can add the image thanks to the code:
<img src="/media/com_hikashop/upload/<?php echo $image; ?>" alt="<?php echo $image; ?>" />

2. It easiest than the popup displayed when adding a product.
You need a link like:
		<a title="<?php echo JText::_('SHOW_CART');?>" class="modal" rel="{handler: 'iframe', size: {x: 760, y: 480}}" href="<?php echo hikashop_completeLink('cart&task=showcart',true); ?>">
			Show Cart
		</a>

Last edit: 11 years 7 months ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #95698

I should have done something wrong because it does not work.
The first line of code i should paste it at the start of product cart rigt?
and then where i wantthe image to be displayed add the <td> plus the code</td>.
I did that and did not work so something i did wrong. Sorry for inconvenience

And for the second one i sould create a custom module with that code or i sould paste it in other place?

Last edit: 11 years 7 months ago by condorazul.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #95750

Hi,

1. In the view "product / cart" you need the var "$row->cart_product_id;" so put the code:

$db = JFactory::getDBO();
						$query = 'SELECT `file_path` FROM `#__hikashop_file` WHERE file_ref_id = "'.(int)$row->cart_product_id.'" LIMIT 1';
						$db->setQuery($query);
						$image = $db->loadResult();
After:
					foreach($this->rows as $i => $row){
						$cart_id = $row->cart_id;

2. You can place this code where you want.

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #95998

it does not work for me it displays a error line saying that image variable is not defined.
what i did is paste the code you gave:
foreach($this->rows as $i => $row){
$cart_id = $row->cart_id;
if(empty($row->cart_product_quantity)&& $cart_type != 'wishlist' || $row->hide == 1) continue;
if($group && $row->cart_product_option_parent_id) continue;
$productClass->addAlias($row);
$db = JFactory::getDBO();
$query = 'SELECT `file_path` FROM `#__hikashop_file` WHERE file_ref_id = "'.(int)$row->cart_product_id.'" LIMIT 1';
$db->setQuery($query);
$image = $db->loadResult();
?>
and in the table i added the <td><img....</td> code you gave me.

The following user(s) said Thank You: cbenard

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96093

Hi,

You need to replace "#_" by your database prefix. I think that's why you have an error.

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96393

i insert this code into a custom html module but it does not work, where should i insert it?

<a title="<?php echo JText::_('SHOW_CART');?>" class="modal" rel="{handler: 'iframe', size: {x: 760, y: 480}}" href="<?php echo hikashop_completeLink('cart&task=showcart',true); ?>">
Show Cart
</a>

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96418

Same problem undefined variable image.

that is what i wrote
foreach($this->rows as $i => $row){
$cart_id = $row->cart_id;
if(empty($row->cart_product_quantity)&& $cart_type != 'wishlist' || $row->hide == 1) continue;
if($group && $row->cart_product_option_parent_id) continue;
$productClass->addAlias($row);
$db = JFactory::getDBO();
$query = 'SELECT `file_path` FROM `gp8u6_hikashop_file` WHERE file_ref_id = "'.(int)$row->cart_product_id.'" LIMIT 1';
$db->setQuery($query);
$image = $db->loadResult();
?>

and the other one
<tfoot>
<tr>
<td colspan="<?php echo $row_count;?>">
<hr />
</td>
</tr>
<tr>
<?php $colspan = '1';
if($this->params->get('show_cart_quantity',1)){
$colspan=2;
} ?>

<td class="hikashop_cart_module_product_total_title" colspan="<?php echo $colspan; ?>">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</td>
<td class="hikashop_cart_module_product_total_value">
<?php
$this->row=$this->total;
echo $this->loadTemplate();
?>
</td>
<td><img src="/media/com_hikashop/upload/<?php echo $image; ?>" alt="<?php echo $image; ?>" /></td>

<?php if($this->params->get('show_cart_delete',1)){ ?>
<td>
</td>
<?php }?>
<?php
if($row_count<2){ ?>
<td>
</td>
<?php }?>
</tr>
</tfoot>
<?php } ?>
<tbody>

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96467

Hi,

<a title="<?php echo JText::_('SHOW_CART');?>" class="modal" rel="{handler: 'iframe', size: {x: 760, y: 480}}" href="<?php echo hikashop_completeLink('cart&task=showcart',true); ?>">
Show Cart
</a>

I just tried this code on my end, and it's displaying the cart in a popup when clicking on "show cart". This should work, even if it's in a custom html module.

For the other point, are you sure that you have an image for the product added in the cart ?
Thanks to use "<?php var_dump($row->cart_product_id); ?> to see if the product id is returned.
If not, you have to use another var, else there is no image for this product. In all cases you have to add a check to see if the image is present or not.
Something like:
<td>
<?php if(!empty($image)){ ?>
<img src="/media/com_hikashop/upload/<?php echo $image; ?>" alt="<?php echo $image; ?>" />
<?php } ?>
</td>

Last edit: 11 years 7 months ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96522

if i add the last string you gave me nothing is displayed when i add the first one <?php var_dump($row->cart_product_id); ?>
displays: string(1) "5".
i´m sure i have an image on it i



i´m using joomla 3 and last hikashop version.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96523

i went to joomla modules
new html module
paste the link and
when i use the
<a title="<?php echo JText::_('SHOW_CART');?>" class="modal" rel="{handler: 'iframe', size: {x: 760, y: 480}}" href="<?php echo hikashop_completeLink('cart&task=showcart',true); ?>">
Show Cart
</a>
what i get is forbidden access, the object is write protected or cant be readed by the server, error 403.
I´m runing the page in loclhost with xampp and las php version.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96556

For the image in cart issue, could you give us a backend access ?

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96561

I have the web locally installed but im going to upload it tonight and give you the acess.
Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96566

I´ve send you the access, thank yo

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96633

Cart image issue: Can you check in your phpMyAdmin in the table "gp8u6_hikashop_file" if there is an item with the file_ref_id "7" ? And try the previous sql request in phpMyAdmin.

Show cart module: You can't add php inside Joomla article by default, you can use a plugin to add php inside.

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96668

I installed direct php but it does not open the cart in a modal window instead of it it redirect to a cart in the same page and to directly print the cart.
and in the database i only have file_ref_id 1,2,3,4 no more.
What do you mean with try the previus request in phpmyadmin???

Last edit: 11 years 7 months ago by condorazul.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96727

Show cart module: you don't have declared the behavior modal in your template, that's why the popup is not working. Try to add <?php JHTML::_('behavior.modal'); ?> in the head part of your template.

Cart image issue: You should have an entry for the file_ref_id '7'. You can try to remove the image and set it again.
We are adding an option to display the images in the cart. It will be in the next release.

Please Log in or Create an account to join the conversation.

  • Posts: 441
  • Thank you received: 24
11 years 7 months ago #96842

both did not work, i added behaviour modal in firs line in template.php nothinghappens
deleted image and reup and did not work too.
Next release when it would be ready?

Please Log in or Create an account to join the conversation.

Time to create page: 0.114 seconds
Powered by Kunena Forum