VirtueMart Error - This webpage is not available ERR_CONNECTION_TIMED_OUT - joomla

Hi I am getting an "This webpage is not available ERR_CONNECTION_TIMED_OUT" error on the backend of a joomla website that I am maintaining recently.
I have contacted Blacknight to see what the problem was and I was told it was to do with line 225 in the virtuemart extension:
if ($iBrowseCol == $BrowseProducts_per_row || $iBrowseProduct == $BrowseTotalProducts) {?>
I have added the paragraph of code if someone things the problem is else where:
<?php
$iBrowseProduct ++;
// Do we need to close the current row now?
if ($iBrowseCol == $BrowseProducts_per_row || $iBrowseProduct == $BrowseTotalProducts) {?>
</div>
<?php
$iBrowseCol = 1;
} else {
$iBrowseCol ++;
}
}
Thanks in advance.

I have this problem with another shopping cart and it was because I turn on the Joomla gzip.
Go to Joomla global configuration - Server - Gzip Page Compression - No
This is how I fixed the issue on my site.

Related

Magento 1.9 vertical menu issue

i've stumbled on a relatively known issue, but i cant find the solution.
I am using magento 1.9 CE
I have found some code to show a vertical menu of the current categorie with its children, and on the homepage the root category and everything works fine except 1 little detail. The subcategories don't load in the order of the backend. It's important that the same order as how it is setup in teh backend loads. I have tried allot of variations, like getCChildrenCategories but then it results in a blnak page. I also found menu's that do work, but then when i visit the homepage, i get an error and the page turns blank.
This is the code i am using at the moment.
<section class="block-layered-nav custom-left-menu" role="navigation">
<div class="block-content">
<?php
echo "<dl id='narrow-by-list2'>";
$_category = $this->getCurrentCategory();
$subcatid = $_category->getId();
$parentCategory = Mage::getBlockSingleton('catalog/navigation')->getCurrentCategory()->parent_id;
$name = $_category->getName();
$root_category = Mage::getModel('catalog/category')->load($subcatid);
$subcategories = $root_category->getChildren();
if($subcategories != "")
{
echo "<span class='h3'>Categorie</span><ol>";
foreach(explode(',',$subcategories) as $subcategory) {
$category = Mage::getModel('catalog/category')->load($subcategory);
echo '<li><a href="'.$category->getURL() .'" title="'.$category->getName().'" />'.$category->getName().'</a></li>';
}
}
else
{
echo "<span class='h3'>Categorie</span><ol>";
$root_category = Mage::getModel('catalog/category')->load($parentCategory);
$subcategories = $root_category->getChildren();
foreach(explode(',',$subcategories) as $subcategory) {
$category = Mage::getModel('catalog/category')->load($subcategory);
echo '<li><a href="'.$category->getURL() .'" title="'.$category->getName().'" />'.$category->getName().'</a>';
}
}
echo "</ol>";
?>
</div>
</section>
Any help would be much appreciated. All i know is that, somewhere in this code its not calling the categories the right way, i also tried:
$currentCat = Mage::registry('current_category');
but this results in a blank homepage.
Here is a link to the dev enviremont: http://dev.smoldersbv.nl/schroeven-en-bouten.html
If you hover over the main navigation you see a different order, the correct order, then on the left menu.
This is normal $this->getCurrentCategory() get the current category = the category you are currently browsing.
On the home page you are not in a category, like on any other cms pages or even on the contact us page, ... (and there are lots more). So you have nothing in the current category which is obvious.
Problem solved,
The way of the requests where wrong therefor this menu is unable to produce the order of the backend so i ended up using a whole different mockup.
thnx for looking anyway.

You are not authorised to view this resource - Joomla

I am using joomla 2.5.9 version, and I would like Joomla to redirect me to the login page if I am not logged in when i click an article which the Permission Access is for Registered only, but instead Joomla returns me this message: You are not authorised to view this resource.
And I dont see any reason why joomla by default havent made it redirect to login page.
Thanks
This doesn't answer your exact question, but I think it's a good workaround. I'm working on the same issue. My approach at the moment is to check the messages for the "not authorised" string, and then set a flag based on that. You can then check that flag anywhere in template and either redirect, or just choose to optionally show the login form.`
/* get message from app */
$app = JFactory::getApplication();
$messages = $app->getMessageQueue();
/* set login flag to 0 */
$showlogin = 0;
/* if there is a message set... */
if (isset($messages[0])) {
/* loop through messages and check for the "not authorised" string */
foreach ($messages as $msg) {
if ($msg["type"] == "error" && strpos($msg["message"], "not authorised") ) {
/* if found, update login flag */
$showlogin = 1;
}
}
}
/* include in template body - you could redirect here instead of including login form */
if ($showlogin) { ?>
<jdoc:include type="modules" name="login-form" style="none" />
<?php } ?>
`
this happens when you try to access an article which is not visible, but the category is publically visible.
Seems like it is not considered a bug, but I think its a pretty unexpected "feature".
To fix this you can edit:
joomla/components/com_content/views/article/view.html.php
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') == false && ($item->params->get('show_noauth', '0') == '0'))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$uri = urlencode(base64_encode(JURI::getInstance()->toString()));
JFactory::getApplication()->redirect(
JRoute::_('index.php?option=com_users&view=login&return='. $uri, false)
);
return;
}
This will show the login screen and return to the article after a succesfull login.
If you dont want to edit the core file (because you want to update your system), you have to create a system plugin to override this.

Magento shopper theme mulitple cart-top-title on "add to cart"

I'm using the Magento Shopper Theme (http://shopper.queldorei.com/).
When I add a product to my shops cart, it adds multiple elemtns of
<div class="cart-top-title">
<a href="https://droppinstudio.dk/horsepony/index.php/checkout/cart/" class="clearfix">
<span class="icon"></span>Cart</a></div>
I've figured out that it is the jQuery that makes the mistake here:
function setLocationAjax(url, id)
{
...
if (data.status != 'ERROR' && $('.cart-top-container').length) {
$('.cart-top-container').replaceWith(data.cart_top);
}
...
}
Does anybody have a good idea of what to do to fix this?
You should have a look into the CartController, and change the response variable (data.cart_top).
The location of CartController depends on the module the theme uses. The core CartController is located in app/code/core/Mage/Checkout/controllers/CartController.php.
Hope this helps.
Thank you Erwin, that helped me figure out what is wrong.
The CartController is located in app/code/local/Excellence/Ajax/controllers/ and is actually named IndexController.php.
Line 52-54 sets the data.cart_top response:
$sidebar_header = $this->getLayout()->getBlock('cart_top')->toHtml();
Mage::register('referrer_url', $this->_getRefererUrl());
$response['cart_top'] = $sidebar_header;
A fix could be to change the way the cart_top block is designed, and remove the 'cart-top-title' from cart_top.phtml and put it in a file of its own and include it in header.phtml.
Turns out the acutal replacement happens in line 85 of ajaxcart.js (function setLocationAjax).
A quick fix for me was to delete the div with jQuery like so:
if (data.status != 'ERROR' && $('.cart-top-container').length) {
$('.cart-top-title').remove();
$('.cart-top-container').replaceWith(data.cart_top);
}
js file here: skin/frontend/default/shopper/js/ajaxcart/ajaxcart.js
cart_top.phtml here: app/design/frontend/default/shopper/template/checkout/cart/cart-top.phtml
header.phtml here: app/design/frontend/default/shopper/template/page/html/header.phtml

Redirect customer back to product after login in Magento

By default, when a customer logs in in Magento, they are redirected to their account page.
I'd like to redirect the customer back to the product/page they were visiting before.
How can I do this in Magento? I guess an observer should be the best way, but I have no idea where to start from.
<a href="<?php echo Mage::getUrl('customer/account/login', array('referer' => Mage::helper('core')->urlEncode($this->helper('core/url')->getCurrentUrl())))?>" >Log In</a>
If a logged out customer is on any page on your site, once they click on this anchor tag it will lead them to login page, after they login successfully, they are redirected to the page they were on when they clicked on the anchor tag.
This is an alternative/emulator of the Login link in Magento's original "Top links" logic.
on product page add these code
<?php Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->helper('core/url')->getCurrentUrl()); ?>
I have put the magento login into a lightbox popup so this code on the page before set's the referral URL. Hope it helps.
<?php
$current_url = $this->helper('core/url')->getCurrentUrl();
$current_session = Mage::getSingleton('customer/session');
if(isset($current_session)) $current_session->setData("before_auth_url", $current_url);
?>
You can also put this in the head so it will set the before_auth_url on every page. But make sure you wrap this in a conditional so it doesn't set the before_auth_url on the login pae itself. Below is the code I used to do this.
<?php
if (! Mage::helper('customer')->isLoggedIn()) {
$current_url = $this->helper('core/url')->getCurrentUrl();
if((strpos($current_url, 'login') > -1) || (strpos($current_url, 'sign-in') > -1) || (strpos($current_url, 'checkout') > -1) ) {
} else {
$current_session = Mage::getSingleton('customer/session');
if(isset($current_session)) $current_session->setData("before_auth_url", $current_url);
}
}
?>
Not so good way but it works.
$redirectUrl = $_SERVER['HTTP_REFERER'];
echo '<script>document.location.href="'. $redirectUrl . '";</script>';
The extension Custom Login Redirect Pro can help you. You can redirect to referer using the shortcode {{referer}}.

Displaying custom product attributes based on customer group (Magento)

I have wholesale attributes for certain products under one store in Magento. I would like to set it so those particular attributes only appear on the product page IF the customer is logged in and they are in the Wholesale customer group.
Is this possible?
Something like this should work, although I have not tested this together. It's assuming your wholesale groupid = 2 and that you want to show the product attribute 'productvideos'
app/design/frontend/default//template/catalog/product/view.phtml
if($_isLoggedIn === true){
$_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
if($_myGroupId == 2){
print $_helper->productAttribute($_product, $_product->getProductvideos(), 'productvideos');
}
}
Credit:
http://www.magentocommerce.com/boards/viewthread/22597/#t74992
Okay, here's the solution.
In template/catalog/product/view> attributes.phtml use the following:
<?php
$_isLoggedIn = $this->helper('customer')->isLoggedIn();
if($_isLoggedIn == true){
$_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
if($_myGroupId == 2){
echo '<td class="label">Attribute Name/Label</td>';
echo '<td class="label">';
if ($_product->getResource()->getAttribute('attribute_id')->getFrontend()->getValue($_product)):
echo $_product->getResource()->getAttribute('attribute_id')->getFrontend()->getValue($_product);
endif;
echo '</td>';
}
}
?>
Thanks to #nvoyageur for the initial pointer in the right direction!
I had the same use case and I used the GroupsCatalog extension, which is free and works perfectly for me.

Resources