When switching language, the cart preview button labels are in the language when the cache was generated.

Current workaround on commerce_ajax_cart_show_contents function:

/*if ( FALSE !== ($cache = cache_get($cid,'cache')) ) {
    print $cache->data; 
  } else {*/
    $view = views_get_view('commerce_cart_block');
    $view->set_arguments(array($cart_id)) ;
    $output = $view->execute_display() ;
    if ( !$view->result || count($view->result) == 0 ) {
      $output = '<div class="empty-cart">' . variable_get('commerce_ajax_cart_text', t('There is no product in your cart') ) . '</div>' ;
    }
    //cache_set($cid, $output, 'cache', CACHE_TEMPORARY) ;
    print $output;
  //}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mendicm’s picture

I solved the issue concatenating the language code on $cid. Now there is one cahe per language.

hosais’s picture

Hi,

May I know how to translate the rest part of Ajax cart? In translation interface, I did not find the strings.

Thanks.

hosais

joelpittet’s picture

Status: Active » Needs review
FileSize
1.98 KB

@mendicm does this patch work for you?

@hosais I committed another patch to help with translatable strings. @see #2364169: Untranslatable strings

joelpittet’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
joelpittet’s picture

Status: Needs review » Fixed

Fixed this in dev, thank you for the report @mendicm

  • joelpittet committed e352862 on 7.x-1.x
    Issue #2341377 by joelpittet, mendicm: Ajax cart preview cache not...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.