简体   繁体   English

如何将ubercart添加到购物车按钮更改为图像[Drupal 7]?

[英]How to change ubercart add to cart button to image[Drupal 7]?

  1. ubercart in add to cart button i want to change this as image of [add_to_cart.jpg]. 我想将其更改为[add_to_cart.jpg]的图片。
  2. How to update cart page with extra columns like unit price .. 如何使用额外的列(如单价..)更新购物车页面
  3. Add extra column in ubercart cart-page by default this is table format.here some filed like [remove ,title,unit,total]. 默认情况下,在ubercart购物车页面中添加额外的列,这是表格格式。此处有些文件,例如[remove,title,unit,total]。

Thanks 谢谢

we use in drupal 7 ubercart 3. here we use this function for update cart page. 我们在drupal 7 ubercart 3中使用。在这里,我们将此功能用于更新购物车页面。

This is answer of 2 question. 这是2个问题的答案。

** hook_form_uc_cart_view_form_alter**. ** hook_form_uc_cart_view_form_alter **。 we got a solution . 我们有一个解决方案。

implementation like.. 
function modulename_form_uc_cart_view_form_alter(&$form, &$form_state) {

  if (count($form['items'])) {
    // Add edit column to tapir table.
    $form['items']['#columns']['unit'] = array(
      'cell'   => t('Unit Price'),
      'weight' => 2,
    );

    // Add edit link to all products.
    foreach (element_children($form['items']) as $key) {

      if (isset($form['items'][$key]['cart_item_id'])) {

         $form['items'][$key]['unit'] = array(
         '#markup' =>t(uc_currency_format(sprintf ("%.2f", $form['items'][$key]['#entity']->sell_price ))),
        );

      }
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM