News:

Looking for documentation? Take a look on our wiki

Main Menu

Some minor bugs ive found

Started by Marttyn, September 30, 2013, 13:57:31 PM

Previous topic - Next topic

Marttyn

Im making my template for VM, and im modifying almost all the available views, so occasionally i find some bugs. Sometimes there are not even bugs, just incomplete migrations of code from earlier versions, or just missing fragments of code.
Hope someone take a look to this and make appropriate corrections.



RECOMMEND VIEW
The mail_confirmed.php generates a close modal box button, if it is a facebox, but not if it is a fancybox. Checking on ask a question view, the mail_confirmed.php has a small script that generates the appropriate close button, checking if facebox or fancybox is enabled.
SOLUTION: copy the script from ASK A QUESTION to RECOMMEND view.



PRODUCTDETAILS VIEW
Generating the PDF/PRINT/EMAIL link icons:
The icons are generated with this code:
if (VmConfig::get('pdf_icon', 1) == '1') {
echo $this->linkIcon($link . '&format=pdf', 'COM_VIRTUEMART_PDF', 'pdf_button', 'pdf_button_enable', false);
}
echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');
echo $this->linkIcon($MailLink, 'COM_VIRTUEMART_EMAIL', 'emailButton', 'show_emailfriend', false);


As you can see, for the PDF icon, it checks with VmConfig what the configuration is, and if its true generates the icon. But for print and email it does not check that.
Digging here ive found that function "linkIcon" already check the configuration setting before generating the icon, so it looks like the VmConfig::get for PDF link is redundant here.
SOLUTION: i didnt try, but looks like removing the IF block should still check for the config setting before generating the icon.



PRODUCTDETAILS VIEW
Recommend email is shown in a modal box DIFFERENT from others that cant be closed from a link or button.
When user recommend and gets redirected to the mail_confirmed.php a close button is generated with an "onclick" attribute that close the facebox or fancybox (supposing that the first bug ive commented is already solved). This close button CAN NOT CLOSE the modal box.
SOLUTION: Its quite difficult to explain. I think that most important is to have a consistent modal function that works the same for all links.
In my case, i noticed that "ask a question" button generated a modal that was same looking than "recommend", but with different generated html, and different calling to the modal window.
Ask a question use this code on top of default.php (on productdetails view)
$document->addScriptDeclaration("
//<![CDATA[
jQuery(document).ready(function($) {
$('a.ask-a-question').click( function(){
".$box."
return false ;
});
/* $('.additional-images a').mouseover(function() {
var himg = this.href ;
var extension=himg.substring(himg.lastIndexOf('.')+1);
if (extension =='png' || extension =='jpg' || extension =='gif') {
$('.main-image img').attr('src',himg );
}
console.log(extension)
});*/
});
//]]>
");


Its a script that catch the click on the link and generates the modal. And when reaching the mail_confirmed.php of askquestion view, the close button WORKS.
So ive added a catch click on recommend link to generate the modal like the ask a question, and removed the inline modal generator (class="modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}")

NOTE: print icon generates the same modal than recommend, but in this case, no CLOSE button is generated on the iframe output, so i didnt modify this. But i still think that all modal should be generated the same way, reducing coding, and using less resources on server and client side.



PRODUCTS OUT OF STOCK
When selected configuration "products out of stock can be ordered, and Availability field is shown".
I use "COM_VIRTUEMART_ON_REQUEST" value for this field, and a language override to replace this string on each language i use (english and spanish).
This works ok for normal products, but for products with child products, stockable variants or custom fields, the text is not translated, and instead the "COM_VIRTUEMART_ON_REQUEST" string is shown.
I realize that in fact, this text IS TRANSLATED on server side, but then some script on client side is modifying this text according to the variant or custom field selected, and changing back to "COM_VIRTUEMART_ON_REQUEST" again.
SOLUTION: It may be possible to modify the script to retrieve the translated value of the string instead of the string it self? Adding JTEXT wouldnt fix this?



OTHER THOUGHTS
Some parts of the code are away from modification as they are part of the VM core, but i think it should be kept on the VIEW side. Im referring to "linkIcon" (to generate PDF/Print/Email icons) or the way stockable variant product generates the select boxes. Both keep away the class attribute, and add inline style to to objects. Even adding an IMPOSSIBLE TO REACH ID, like "customPrice03". This makes almost impossible to style with CSS.
Maybe adding classes to the objects, and not adding inline style would help.

This is just what ive found today. Im almost finishing with styling of my views, and ive found many other things like the ones described above, but didnt realize to write them down, so now are lost... Any other i found i will post.

Regards!

Marttyn

On backend configuration there is an checkbox option to show the image of the products in the cart view, but in cart view is not implemented. It always show the image, either the checkbox is on or off.
SOLUTION: Use this IF statement arround the image from the cart view
if(VmConfig::get ('oncheckout_show_images', 1)) {
...this will only be shown if the checkbox is on...
}

Milbo

Heyho Marttyn, thanks for your fixes (a patch for svn would be perfect, btw).

I could use the first fixes. I have no idea for the product out of stock thing. The images for cart works. Maybe the template shows then empty divs (placeholders for the images).
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Marttyn

Hey Milbo!
What do you mean by "svn patch"?

for the OUT OF STOCK i use this:

In that field i use COM_VIRTUEMART_ON_REQUEST, and then i add that string in Joomla translation strings to replace for "On Request" (english) or "Bajo Pedido" (spanish).
When a product have 0 stock and doesnt have availability image, the COM_VIRTUEMART_ON_REQUEST will be shown, and replaced for the correct language traanslation.
This work fine for regular products, and also just tried with cart variant products, and works fine as well. But when a product has child products as cart variant (with stockable variant), the COM_VIRTUEMART_ON_REQUEST string return translated for a fraction of a second while the page finish loading, and then this text change back to COM_VIRTUEMART_ON_REQUEST. It looks like the plugin changes the availability depending on the child product chosen, so that is why the COM_VIRTUEMART_ON_REQUEST string is shown.
SOLUTION: make stockable variant plugin to retrieve translated string (tested and working).
File plugins/vmcustom/stockable/stockable.php  LINE 238:
: $field->child[$child_id]['product_availability'] = VmConfig::get('rised_availability');
Change to:
: $field->child[$child_id]['product_availability'] = JText::_(VmConfig::get('rised_availability'));




For the Mini image shown next to each cart product:
On com_virtuemart/views/cart/tmpl/default_pricelist.php LINE 140
The original code for generating the image is this:
<?php if ($prow->virtuemart_media_id) { ?>
<span class="cart-images">
<?php
if (!empty(
$prow->image)) {
echo $prow->image->displayMediaThumb (''FALSE);
?>

</span>
<?php ?>


For me, this display the image no matter what configuration i have.
I think a solution for this should be:
<?php
if(VmConfig::get ('oncheckout_show_images'1)) {
if (!empty($prow->virtuemart_media_id)) { ?>

<span class="cart-images">
<?php
if (!empty($prow->image)) {
echo $prow->image->displayMediaThumb (''FALSE);
?>

</span>
<?php }
?>


This way first check what the config is, and then generates the image acording to the config value.
Tell me if you still dont understand me :)

Milbo

Quote from: Marttyn on October 01, 2013, 16:01:21 PM

<?php if ($prow->virtuemart_media_id) { ?>
<span class="cart-images">
<?php
if (!empty(
$prow->image)) {
echo $prow->image->displayMediaThumb (''FALSE);
?>

</span>
<?php ?>



Then use this


<?php if ($prow->virtuemart_media_id and if (!empty($prow->image)) { { ?>
<span class="cart-images">
<?php

echo $prow->image->displayMediaThumb (''FALSE);
?>

</span>
<?php ?>
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Marttyn

Hey Milbo!
Sorry to insist. Im running a clean install of Jomla, with a clean install of VM 2.0.24, and also installed the sample data from VM.
The image is showing on the cart, no matter what the configuration is.
If in this new version the configuration does not work right out of the box, it should be a bug, right?
Check this:

jenkinhill

Image display in cart is working fine for me, vanilla install of J2.5.14 + VM2.0.24   - in your example, for me,  if you empty the cart and then go and add another item then no image appears. The cart must be emptied and a new cart will then show image or not, as configured.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Marttyn

Ok, jenkinhill, i was only updating cart, and not removing and adding again as you said.
I looks like the media is being loaded on the $cart table, and when generating this table is where the configuration check is made...
Sorry i was persistent with this, now i understand.

Other bug ive found: When you click on -RECOMEND TO A FRIEND- email icon of product view, a modal popup window appears with -ASK A QUESTION- form.
Looks like the "recomend to a friend" modal window was  corrected as i suggested in my first post.
But the link is wrong, the href is pointing to "ask a question" instead. Check on line 51 of default.php of product view.

In this case (email to a friend, ask a question, product added to cart popup) facebox or fancybox for modal popup its used, but in the case of "Print" icon, mootools lightbox its used by VM.
My question is WHY HAVE 3 OPTIONS (sometimes used at the same time) FOR A MODAL WINDOW? If we use fancybox, why mootools lightbox is loaded and used?
In my opinion as lightbox, and fancybox looks the same, i whould stick to lightbox, as its part of Joomla, so no extra scripts needs to be loaded.


Regards!

AH

facebox or fancybox

Ahhh, the eternal dilema.

We now have a choice thanks to the devs , not sure why such a change was on their roadmap but it was.
Regards
A

Joomla 3.10.11
php 8.0

Milbo

Grummel, grummel, Please test this one.

[attachment cleanup by admin]
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Marttyn

 :)
Although i didnt test your mod, ive read it, and looks pretty much the same as what i did to solve this problem.
Thanks for paying attention to this Max!

mfgrmn

Quote from: Marttyn on October 02, 2013, 19:38:17 PM
Ok, jenkinhill, i was only updating cart, and not removing and adding again as you said.
I looks like the media is being loaded on the $cart table, and when generating this table is where the configuration check is made...
Sorry i was persistent with this, now i understand.

Other bug ive found: When you click on -RECOMEND TO A FRIEND- email icon of product view, a modal popup window appears with -ASK A QUESTION- form.
Looks like the "recomend to a friend" modal window was  corrected as i suggested in my first post.
But the link is wrong, the href is pointing to "ask a question" instead. Check on line 51 of default.php of product view.

In this case (email to a friend, ask a question, product added to cart popup) facebox or fancybox for modal popup its used, but in the case of "Print" icon, mootools lightbox its used by VM.
My question is WHY HAVE 3 OPTIONS (sometimes used at the same time) FOR A MODAL WINDOW? If we use fancybox, why mootools lightbox is loaded and used?
In my opinion as lightbox, and fancybox looks the same, i whould stick to lightbox, as its part of Joomla, so no extra scripts needs to be loaded.


Regards!

Hi Marttyn,

have you been able to receive a picture of the product to which you send to yourself a recommend to friend email? Because I am not getting one. And if its not standard altogether with VM can you or anyone here please add a script that will allow for it to be added to the email automatically? I believe its the file mail_html.php found in components > com_virtuemart > views > recommend > tmpl > mail_html.php. I'm using vm fancybox if that makes any difference. I'm on VM 2.0.24c/Joomla 2.5.16.

Thanks in advance!

mfgrmn

#12
Quote from: Milbo on October 03, 2013, 12:17:17 PM
Grummel, grummel, Please test this one.

I like this script. It fixed my recommend to a friend problem but now It seems I lost fancybox version and  went back to its default popup box. Should I be worried?? Does mean fancybox is rendered non-functional? :(

By the way I love the new style of the products page where it shows the star ratings on top nice and big, but there are a few issues though. (See screenshots of before and after pics.)

Issue One: the word "price" is still there above the sales price and can't be removed and its empty with no price too. So that needs to come out.

second: I lost the tab format which I liked between description|ratings|and more info. Now they're separated where you have to scroll down. How do I get the tab format back please?

third: the big stars down by where you write your comment to rate the product are all overlapping over some tiny stars right behind them. Its like a double image. And something funny goes on when you mouseover them they disappear and reappear! :( That needs to be fixed for sure. 

fourth: the product picture is ginormous and is colliding into the text on the right side! I can restyle that part myself but just thought I mention it anyways. Its to big stylewise.



[attachment cleanup by admin]