Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
//}
Comment | File | Size | Author |
---|---|---|---|
#3 | ajax_cart_preview_cache-2341377-3.patch | 1.98 KB | joelpittet |
Comments
Comment #1
mendicm CreditAttribution: mendicm commentedI solved the issue concatenating the language code on $cid. Now there is one cahe per language.
Comment #2
hosais CreditAttribution: hosais commentedHi,
May I know how to translate the rest part of Ajax cart? In translation interface, I did not find the strings.
Thanks.
hosais
Comment #3
joelpittet@mendicm does this patch work for you?
@hosais I committed another patch to help with translatable strings. @see #2364169: Untranslatable strings
Comment #4
joelpittetComment #5
joelpittetFixed this in dev, thank you for the report @mendicm