0

Since a few weeks I'm using two themes for the Magento webshop. One for smartphones and one for desktop/tablets. The smartphone theme should only be used on smartphones, but the homepage of the this theme is also displayed on tablets. When tablet shows the desktop homepage, smartphones show the desktop homepage to. Thereby, the desktop/tablet theme shows up randomly on smartphones, on just one page (different one each time). Nothing I'm trying to solve the problem seems te work. What I've already tried:

  • Clearing the cache.
  • Flushing the cache.
  • Disable Amasty Full Page Cache.
  • Using different types of string to define the screensize.
  • Adding an acception for tablet (before and after acception for smartphone).

Because it happens randomly, it's hard to investigate what's going on. The log doesn't give any information on this problem. On our development area the two different themes work perfectly. The problem apeared when I added the smartphone theme (via System -> Configuration -> Design -> Themes). I'm using Magento 1.7.0.2. Any ideas wat causes the problem and how to solve it?

0

This definitely sounds like a cache issue. Did you try disabling System > Cache Management > Blocks HTML output cache on your production server? Bear in mind that this might affect overall site speed so use with caution.

If

  • this solves your problem but you still want block caching happening

or

  • you still don't know if this gets rid of your issue but can't afford to let this cache disabled just to evaluate,

try changing function getCacheKeyInfo() in file app/code/core/Mage/Core/Block/Template.php to this:

public function getCacheKeyInfo()
{
    return array(
        Mage::getDesign()->getTheme('default'),
        Mage::getDesign()->getTheme('skin'),
        Mage::getDesign()->getTheme('layout'),
        Mage::getDesign()->getTheme('template'),
        'BLOCK_TPL',
        Mage::app()->getStore()->getCode(),
        $this->getTemplateFile(),
        'template' => $this->getTemplate()
    );
}

, flush your cache and see if this solves your problem. If it does, you'll want to make this a clean solution. If it does not, some module is probably not implemented properly.

  • Almost right! Disabling the Block HTML output cache didn't do the trick for me, but disabling the Amasty Full Page Cache did (I only tried disabling it in System -> Advanced). Will the code you're talking about also work for Amasty cache? I don't want to disable it because it makes the website faster (I disabled it for now, hopefully I will find a workaround soon). – Ellen-Rose van Dijk Nov 18 '16 at 9:57
  • I don't know about Amasty FPC, but it seems like the caching key doesn't always take the current theme into account. Did you enable System > Configuration > Amasty Full Page Cache > Mobile Design already? That might be worth a try, see here for details: amasty.com/knowledge-base/…. If this doesn't work out, you should make use of Amasty's support. The solution I contemplated probably won't work with an external module like this. – pong Nov 18 '16 at 10:36
  • Me again. Got a new problem now, which is fixed bij disabling the Block_HTML cache. I'm using the Blog Pro extension from Amasty and out of the blue Magento started switching between mobile and desktop code for the blogposts. So if desktop is used on desktop, it is also used on mobile. Could you still give me the code you're talking about in your post? – Ellen-Rose van Dijk Dec 21 '16 at 12:56
  • Please see updated answer. If you still need help (at implementing a clean solution or because the problem persists), I'm happy to help free of charge – hey, it's almost xmas – but that would require access to your code/staging area. – pong Dec 21 '16 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.