News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

2.0.9b email - wrong shop url at the bottom link

Started by bytelord, August 17, 2012, 04:23:56 AM

Previous topic - Next topic

bytelord

Hi,

The emails has wrong vendor (shop url) link at the bottom  (after "thank you for purchasing at")

The link redirects to: http://www.domain.com/joomla_folder/index.php?option=com_virtuemart that is incomplete.

inside invoice/tmpl/mail_html_footer.php on line 29 the
$link = JURI::root().'index.php?option=com_virtuemart';

if i am not mistaken it should be: index.php?option=com_virtuemart&view=virtuemart&itemid=xxx (if chane line to index.php?option=com_virtuemart&view=virtuemart works but no itemid).

the same is also inside the mail_raw_footer.php

*As i remember previously was the sef url on that links.

Update:
Checking also the rest of the links are not SEF anymore and also is missing Itemid which means that when someone navigate there are issues with joomla layout  (mostly with module positions cause itemid is missing). I know that using JURI::root() is more "stable" but i prefer the VM shopFunctionsF::getRootRoutedUrl for building the links ...

Thanks
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

It does not work, that is the problem.

It takes the router from the backend, and then there isnt any routing. Using always the FE router is a solution, but I just didnt make it. So we may add this later. You may experiment with it, but be aware that sometimes the emails are sent from the FE and the other time from BE.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bytelord

#2
Yes, you have right. When i was checking on that i had in mind only the FE.
By now is working "fine" with JURI/root.

I have just modify some links cause i use SEF urls and works better from just using juri:root by lucking on (item)id's. On the above issue i just use the following to create the correct sef url/link for store

$link = $link=JURI::root().substr(JRoute::_('index.php?option=com_virtuemart&view=virtuemart'),strlen(JURI::base(true))+1);

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

#3
Ok, finally i figure it out somehow.
Joomla cannot create sef urls in backend (this is normal -joomla's point-), so instead try using the router could use the site application. In the above mail_html_footer before we produce the $link we change app in case the link produced in the backend, also 208e version of VM has the issue that the /administrator or live site was placed prior to link, we remove that also and replaced with null in case that appears. After that we change the application to administrator. The above could be used with SEF and non SEF urls on the be or fe.

<?php
//site url if use administrator application
$be_site substr(JURI::root(), 0, -1);
// Checking if we are in the backend and change to the app site
if(JPATH_BASE == JPATH_ADMINISTRATOR) {
    
JFactory::$application JApplication::getInstance('site');
}

//VM homepage sef url (for example) - SEF url for be and fe. If you use clasic url will work also.
$link JURI::root().substr(JRoute::_('index.php?option=com_virtuemart&view=virtuemart'),strlen(JURI::base(true))+1);

// Check if we are in the backend again
if(JPATH_BASE == JPATH_ADMINISTRATOR) {
     
// when link produced in be we need to remove livesite/administrator in case that been added from URL (usually added instead 
    //we have set the application to the site app)
    
$link str_replace($be_site .'/administrator'$be_site$link);
   
//echo $link;

// Setting back the administrator app
    
JFactory::$application JApplication::getInstance('administrator');
}

//That the printout from mail_html_footer
echo JText::_('COM_VIRTUEMART_MAIL_FOOTER' ) . '<a href="'.$link.'">'.$this->vendor->vendor_name.'</a>';
        echo 
'<br/>';
echo $this->vendor->vendor_name .'<br />'.$this->vendor->vendor_phone .' '.$this->vendor->vendor_store_name .'<br /> '.$this->vendor->vendor_store_desc.'<br />'.$this->vendor->vendor_legal_info;


I have test it both in the BE and FE by sending mails (cancel order, order from fe, etc etc) and the sef url is produced without any problems!So may be helps you out to resolve it in the core.

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

#4
Hey milbo,

Write it again ... same post .. forgot to place on the new 2.0.10 release the right shop url ... paste it again :)


QuoteThe emails has wrong vendor (shop url) link at the bottom  (after "thank you for purchasing at")

The link redirects to: http://www.domain.com/joomla_folder/index.php?option=com_virtuemart that is incomplete.

inside invoice/tmpl/mail_html_footer.php on line 29 the
$link = JURI::root().'index.php?option=com_virtuemart';

if i am not mistaken it should be: index.php?option=com_virtuemart&view=virtuemart

the same is also inside the mail_raw_footer.php
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Milbo

???

We cannnot set the right url, because we the other function.

and as I explained before, I am not in the mood to make a release with errors again. The function is now added in shopfunctionsf and you can fix it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/