Two acyba integration questions

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #106786

Hi,

I posted this questions at Acyba forum but Adrien diverted me to you as he thinks that my questions go beyond his competence on HikaShop.

Question 1:

About showing images in the hikashop_product.php view template:

There's a problem with your suggested code (suggested by Adrien from Acyba):

<?php $image = hikashop_get('helper.image'); echo $image->display($product->file_path,false,$product->product_name); ?>

It is not always showing the first image in the array of images for a product. In my case sometimes is showing the last one or some in the middle. I think the code is not using the image array index.



Question 2:

Also about showing images in the hikashop_product.php view template:

I want to change the size for the picture rendered inside the newsletter so I can set the width or height pixels for the image.


This is the code I use (suggested by Adrien from Acyba)

$image = hikashop_get('helper.image');
echo $image->display($product->file_path,false,$product->product_name);


Won't matter it only gets reduced on screen and not directly from the thumb image downloaded, what I want is that it doesn't look so large.


For the HikaShop rendering views I use this


echo $image->display($image->file_path, 'hikashop_main_image', '', '','', 80, '');


but I think is too much to expect this works. Indeed it doesn't work

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 5 months ago #106990

Hi,

1. change the line:
$query = 'SELECT b.*,a.* FROM '.acymailing_table('hikashop_product',false).' as a LEFT JOIN '.acymailing_table('hikashop_file',false).' as b ON a.product_id=b.file_ref_id AND file_type=\'product\' WHERE a.product_id = '.$tag->id.' LIMIT 1';

to:
$query = 'SELECT b.*,a.* FROM '.acymailing_table('hikashop_product',false).' as a LEFT JOIN '.acymailing_table('hikashop_file',false).' as b ON a.product_id=b.file_ref_id AND file_type=\'product\' WHERE a.product_id = '.$tag->id.' ORDER BY b.file_ordering ASC, b.file_id ASC LIMIT 1';

in the file plugins/acymailing/hikashop/hikashop.php and that should fix the problem.

2. Your code is not correct. It should be:
$image = hikashop_get('helper.image');
echo $image->display($product->file_path,false,$product->product_name, '' , '' ,100,200);

where 100 is the width and 200 the height (that's just an example).

The following user(s) said Thank You: PeterChain

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

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #107006

Big thank you!

I'll be back yo you with the result!

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

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #107359

The code provided for you wirked fine, but I have two doubts about it:

1. For this code:

$image = hikashop_get('helper.image');
echo $image->display($product->file_path,false,$product->product_name, '' , '' ,100,200);

100 and 200 are rluing width and height, but which one prevails in case of non proportionality? My pictures don't have this ratio and the rendered result is neither 100 nor 200 for width or height.

2. Could you suggest me the code to make the image link to the product view in the website?

For example my product view url root is "index.php/catalogo-de-carretillas/producto/product_alias_here

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #107440

Hi,

1. It depends on the dimensions, in your case it should take 100 because it's the lowest value.

2. I think that you can use the code:

$url=JURI::base().'index.php/catalogo-de-carretillas/producto/'.$product->product_alias;

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

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #107445

Ok for question 1.

For question 2:

To make the image thumb link to the product, shall I use your code inside the display() function?
Could you give me a clue?
And why don't you give this feature by default? I think is a very basic need? Is there any inconvenience on this practice so you didn't implement the feature?

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 5 months ago #107505

What feature ?
There is already a default template for the products display in the plugin so there is no need for you to create yours unless you want to customize the display.
For the image, I don't know what code you have in your template. I guess something like that would be ok:

<a href="<?php echo JURI::base().'index.php/catalogo-de-carretillas/producto/'.$product->product_alias; ?>">
<?php
$image = hikashop_get('helper.image');
echo $image->display($product->file_path,false,$product->product_name, '' , '' ,100,200);
?>
</a>

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

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #107759

HI,

I tried the suggested code and effectively links to somewhere, but I get the message that the product is not found.

the link delivered is this:

index.php/catalogo-de-carretillas/producto/?acm=6_26

so I think that maybe product_alias is not working properly, can this be replaced in some way for the product id? or some alternative?

I made several tries ensuring that the product has an alias like this

index.php/catalogo-de-carretillas/producto/lambert?acm=6_26

but is not working also event the product is existing and published.

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 5 months ago #107878

Hi,

Yes of course it is not working as that is not a valid product page URL. The product page URLs have both the id and the alias in the URL, unless you're using some third party SEF system which doesn't do like that.

The URL should actually be:
<?php echo JURI::base().'index.php?option=com_hikashop&ctrl=product&task=show&cid='.$product->product_id.'&name='.$product->alias; ?>

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

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #108009

Sorry for taking so much time in this thread, but I don't get it to work.

I get this error message:

The requested URL /nou_activacions/<br /> <b>Notice</b>: Undefined property: stdClass::$alias in <b>/Volumes/WebDev/MAMP_files/htdocs/nou_activacions/media/com_acymailing/plugins/hikashop_product.php</b> on line <b>14</b><br /> http://localhost:8888/nou_activacions/index.php was not found on this server.


I tried several settings in the SEO Settings section in the global Confgiuration of joomla with no different result.


This is my piece of code where all this seems to fail. I probably made a very newbie stupidity:



<td width="102px" valign="top">

<div class="hikashop_acymailing">
<div class="hikashop_acymailing_image">


<!-- THIS IS LINE 14 --> <a href="<?php echo JURI::base().'index.php?option=com_hikashop&ctrl=product&task=show&cid='.$product->product_id.'&name='.$product->alias; ?>">

<?php
$image = hikashop_get('helper.image');
echo $image->display($product->file_path,false,$product->product_name, '' , '' ,100,200);
?>
</a>




</div>
</div>

</td>

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 5 months ago #108020

Change alias by product_alias in the code and that will work.

The following user(s) said Thank You: PeterChain

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

  • Posts: 634
  • Thank you received: 16
11 years 5 months ago #108055

GOD DAMN JESUS! It was so obvious!

It has been in front of my nose the whole day and I could not see it!

THANK YOU!

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

Time to create page: 0.061 seconds
Powered by Kunena Forum