D
D
DenimTornado2013-02-06 15:28:46
Drupal
DenimTornado, 2013-02-06 15:28:46

Can you please help with the theming of the /cart page on Ubercart 3?

We have:
Drupal 7
Ubercart 3
Standard cart page

Required:
Change the display of the image field, that is, now a small picture is displayed, you need to display a larger one, ideally use one of the presets.

What did you do:

function ycredit2_form_uc_cart_view_form_alter(&$form, &$form_state) {
  $form['items']['#columns']['image2']['weight'] = 7;
  $form['items']['#columns']['remove']['weight'] = 6;
  $form['items']['#columns']['total']['weight'] = 5;
  $form['items']['#columns']['qty']['weight'] = 4;

  $form['items']['#columns']['price'] = array(
      'cell' => t('Price'), 
      'weight' => 3,
  );
}
function ycredit2_tapir_table_alter(&$table, $table_id) {
  if ($table_id == 'uc_cart_view_table') {
    foreach (element_children($table) as $key) {
      if (!empty($table['#parameters'][1][$key]['nid'])) {
        $node = node_load($table['#parameters'][1][$key]['nid']['#value']);
        $table[$key]['price'] = array(
          '#markup' => theme('uc_product_price',array('element' => array('#value' => $node->sell_price))),
        );
        $table[$key]['image2'] = array(
          '#markup' => theme('uc_product_image',array('element' => $node->uc_product_image)),
        );
      }
    }
  }
}


As a result, I get an additional column, but the path of the pictures is incomplete, and
<a href="http://mysite.ru/sites/default/files/styles/uc_product_full/public" title="" class="colorbox init-colorbox-processed-processed cboxElement" rel="uc_image_0"><img typeof="foaf:Image" src="http://mysite.ru/sites/default/files/styles/uc_product/public"></a>


What should the code look like?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DenimTornado, 2013-02-06
@DenimTornado

Tex, we managed to get the address of the image:

        $table[$key]['image2'] = array(
          '#markup' => file_create_url($node->uc_product_image['und'][0]['uri']),
        );

How to make an image from a link?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question