Пример #1
0
                              <tr>
                                <td valign="top" nowrap="nowrap">
                                  <b><?php 
        echo $product->qty;
        ?>
 x </b>
                                </td>
                                <td width="98%">
                                  <b><?php 
        echo $product->title . ' - ' . uc_price($price_info, $context);
        ?>
</b>
                                  <?php 
        if ($product->qty > 1) {
            $price_info['qty'] = 1;
            echo t('(!price each)', array('!price' => uc_price($price_info, $context)));
        }
        ?>
                                  <br />
                                  <?php 
        echo t('SKU: ') . $product->model;
        ?>
<br />
                                  <?php 
        if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
            ?>
                                    <?php 
            foreach ($product->data['attributes'] as $attribute => $option) {
                echo '<li>' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array) $option))) . '</li>';
            }
            ?>
Пример #2
0
if (is_array($order->products)) {
    $context = array('location' => 'order-invoice-product', 'subject' => array('order' => $order));
    foreach ($order->products as $product) {
        $price_info = array('price' => $product->price, 'qty' => $product->qty);
        $context['subject']['order_product'] = $product;
        ?>
                          <tr>
                            <td valign="top" nowrap="nowrap">
                              <b><?php 
        echo $product->qty;
        ?>
 x </b>
                            </td>
                            <td width="98%">
                              <b><?php 
        echo $product->title . ' - ' . uc_price($price_info, $context, array(), 'formatted');
        ?>
</b>
                              <?php 
        if ($product->qty > 1) {
            echo t('(!price each)', array('!price' => uc_currency_format($product->price)));
        }
        ?>
                              <br />
                              <?php 
        echo t('SKU: ') . $product->model;
        ?>
<br />
                              <?php 
        if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
            ?>
Пример #3
0
<p>
<?php 
echo t('Products:');
?>
<br />
<?php 
$context = array('revision' => 'themed', 'type' => 'order_product');
foreach ($products as $product) {
    $price_info = array('price' => $product->price, 'qty' => $product->qty);
    $context['subject'] = array('order_product' => $product);
    ?>
- <?php 
    echo $product->qty;
    ?>
 x <?php 
    echo $product->title . ' - ' . uc_price($price_info, $context);
    ?>
<br />
&nbsp;&nbsp;<?php 
    echo t('SKU: ') . $product->model;
    ?>
<br />
    <?php 
    if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
        ?>
    <?php 
        foreach ($product->data['attributes'] as $attribute => $option) {
            echo '&nbsp;&nbsp;' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array) $option))) . '<br />';
        }
        ?>
    <?php 
Пример #4
0
/**
 * Take action when a payment is entered for an order.
 *
 * @param $order
 *   The order object.
 * @param $method
 *   The name of the payment method used.
 * @param $amount
 *   The value of the payment.
 * @param $account
 *   The user account that entered the order. When the payment is entered
 *   during checkout, this is probably the order's user. Otherwise, it is
 *   likely a store administrator.
 * @param $data
 *   Extra data associated with the transaction.
 * @param $comment
 *   Any comments from the user about the transaction.
 */
function hook_uc_payment_entered($order, $method, $amount, $account, $data, $comment)
{
    drupal_set_message(t('User @uid entered a @method payment of @amount for order @order_id.', array('@uid' => $account->uid, '@method' => $method, '@amount' => uc_price($amount, array('location' => 'hook-payment', 'revision' => 'formatted-original')), '@order_id' => $order->order_id)));
}
Пример #5
0
if (!empty($taxes)) {
    echo "Taxes Applied:<br />";
    foreach ($taxes as $tax) {
        echo $tax->name . " rate:" . $tax->rate . "<br>";
    }
}
?>
</p>
<p><?php 
$context = array('revision' => 'themed', 'type' => 'line_item', 'subject' => array('order' => $order));
foreach ($order->line_items as $line_item) {
    if ($line_item['line_item_id'] == 'subtotal' || $line_item['line_item_id'] == 'total') {
        continue;
    }
    $context['subject']['line_item'] = $line_item;
    echo str_replace("xx", "x", $line_item['title']) . ": " . uc_price($line_item['amount'], $context) . "<br>";
    //the xx x thing is for some reason it spells excluding exxcluding.
}
?>
Shipping Cost: 0<br>
Rebate (0%) = 0<br>
<?php 
echo t('Order subtotal:') . " " . $order_subtotal;
?>
<br>
<?php 
echo t('Order total:') . " " . $order_total;
?>
<br>
</p>
<p>
Пример #6
0
/**
 * Control the display of an item in the cart.
 *
 * Product type modules allow the creation of nodes that can be added to the
 * cart. The cart determines how they are displayed through this hook. This is
 * especially important for product kits, because it may be displayed as a single
 * unit in the cart even though it is represented as several items.
 *
 * @param $item
 *   The item in the cart to display.
 * @return
 *   A form array containing the following elements:
 *   - "nid"
 *     - #type: value
 *     - #value: The node id of the $item.
 *   - "module"
 *     - #type: value
 *     - #value: The module implementing this hook and the node represented by
 *       $item.
 *   - "remove"
 *     - #type: checkbox
 *     - #value: If selected, removes the $item from the cart.
 *   - "description"
 *     - #type: markup
 *     - #value: Themed markup (usually an unordered list) displaying extra information.
 *   - "title"
 *     - #type: markup
 *     - #value: The displayed title of the $item.
 *   - "#total"
 *     - "type": float
 *     - "value": Numeric price of $item. Notice the '#' signifying that this is
 *       not a form element but just a value stored in the form array.
 *   - "data"
 *     - #type: hidden
 *     - #value: The serialized $item->data.
 *   - "qty"
 *     - #type: textfield
 *     - #value: The quantity of $item in the cart. When "Update cart" is clicked,
 *         the customer's input is saved to the cart.
 */
function hook_cart_display($item)
{
    $node = node_load($item->nid);
    $element = array();
    $element['nid'] = array('#type' => 'value', '#value' => $node->nid);
    $element['module'] = array('#type' => 'value', '#value' => 'uc_product');
    $element['remove'] = array('#type' => 'checkbox');
    $element['title'] = array('#markup' => node_access('view', $node) ? l($item->title, 'node/' . $node->nid) : check_plain($item->title));
    $context = array('revision' => 'altered', 'type' => 'cart_item', 'subject' => array('cart_item' => $item, 'node' => $node));
    $price_info = array('price' => $item->price, 'qty' => $item->qty);
    $element['#total'] = uc_price($price_info, $context);
    $element['data'] = array('#type' => 'hidden', '#value' => serialize($item->data));
    $element['qty'] = array('#type' => 'textfield', '#default_value' => $item->qty, '#size' => 5, '#maxlength' => 6);
    if ($description = uc_product_get_description($item)) {
        $element['description'] = array('#markup' => $description);
    }
    return $element;
}
Пример #7
0
if (is_array($order->products)) {
    $context = array('revision' => 'formatted', 'type' => 'order_product', 'subject' => array('order' => $order));
    foreach ($order->products as $product) {
        $price_info = array('price' => $product->price, 'qty' => $product->qty);
        $context['subject']['order_product'] = $product;
        $context['subject']['node'] = node_load($product->nid);
        ?>
              <tr>
                <td>&nbsp;</td>
                <td valign="middle" style="text-align:middle"><b><?php 
        echo $product->title;
        ?>
</b></td>
                <td>&nbsp;</td>
                <td valign="middle" style="text-align:middle"><b><?php 
        echo uc_price($price_info, $context);
        ?>
</b></td>
              </tr>
              <?php 
    }
    ?>
              <?php 
}
?>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
Пример #8
0
/**
 * Theme the table listing the items in the shopping cart block.
 *
 * @param $items
 *   An associative array of item information containing the keys 'qty',
 *      'title', 'price', and 'desc'.
 * @ingroup themeable
 */
function tendu_uc_cart_block_items($items)
{
    // If there are items in the shopping cart...
    if ($items) {
        $output = '<table class="cart-block-items"><tbody>';
        $row_class = 'odd';
        $context = array('revision' => 'themed', 'type' => 'price');
        // Loop through each item.
        foreach ($items as $item) {
            $context['subject'] = array('cart_item' => $item, 'node' => node_load($item->nid));
            // Add the basic row with quantity, title, and price.
            $output .= '<tr class="' . $row_class . '"><td class="cart-block-item-qty">' . $item['qty'] . '</td>' . '<td class="cart-block-item-title">' . $item['title'] . '</td>' . '<td class="cart-block-item-price">' . uc_price($item['price'], $context) . '</td></tr>';
            // Add a row of description if necessary.
            if ($item['desc']) {
                $output .= '<tr class="' . $row_class . '"><td colspan="3" class="cart-block-item-desc">' . $item['desc'] . '</td></tr>';
            }
            // Alternate the class for the rows.
            $row_class = $row_class == 'odd' ? 'even' : 'odd';
        }
        $output .= '</tbody></table>';
    } else {
        // Otherwise display an empty message.
        $output = '<p>' . variable_get('cpo_isr_more_empty_cart', 'There are no products in your shopping cart..') . '</p>';
    }
    return $output;
}
Пример #9
0
function lotusPD_uc_catalog_product_grid($array)
{
    global $pager_total_items;
    $products = $array["products"];
    $catalog = $array["catalog"];
    //learn_taxonomy_ancestry($catalog->tid);
    $product_table = '<div class="full-content clearfix">';
    $product_table .= '<div class="column left">';
    $product_table .= ' <div class="column-header light">';
    $product_table .= '   <span class="colorblock" style="background:#' . $catalog->image['hex'] . ';">&nbsp;</span><span class="title">' . l($catalog->name, "catalog/" . $catalog->tid) . '</span>';
    $product_table .= ' </div>';
    $product_table .= '</div>';
    $product_table .= '<div class="column middle-right">';
    $product_table .= '  <div class="filter-holder clearfix">';
    $product_table .= '    <div class="filter middle">';
    $product_table .= ' <div class="column-header dark info">';
    $on_page = variable_get('uc_product_nodes_per_page', 12);
    $product_table .= "(<span>" . ($pager_total_items[0] > $on_page ? $on_page : $pager_total_items[0]) . "</span> prodotti di <span>" . $pager_total_items[0] . "</span> totale)";
    $product_table .= '  </div>';
    $product_table .= '  </div>';
    $product_table .= '  <div class="filter right">';
    $product_table .= $array["pager"];
    $product_table .= ' </div>';
    $product_table .= '</div>';
    $product_table .= '<div class="category-grid-products">';
    $count = 0;
    foreach ($products as $nid) {
        $product = node_load($nid);
        $context = array('revision' => 'themed', 'type' => 'product_version_all_imballo', 'subject' => array('node' => $product, 'sku' => $version_data->sku, 'offer' => $version_data->offerta));
        if ($count == 0) {
            $product_table .= "<div class='product-row clearfix'>";
        } elseif ($count % variable_get('uc_catalog_grid_display_width', 3) == 0) {
            $product_table .= "</div><div class='product-row clearfix'>";
        }
        $titlelink = l($product->model, "node/{$nid}", array('html' => TRUE));
        if (module_exists('imagecache') && ($field = variable_get('uc_image_' . $product->type, '')) && isset($product->{$field}) && file_exists($product->{$field}[0]['filepath'])) {
            $imagelink = l(theme('imagecache', 'product_list', $product->{$field}[0]['filepath'], $product->title, $product->title), "node/{$nid}", array('html' => TRUE));
            //$minilink = l(theme('imagecache', 'product_list_mini', $product->{$field}[0]['filepath'], $product->title, $product->title), "node/$nid", array('html' => TRUE));
            $minilink = "";
            foreach ($product->{$field} as $item) {
                // loop through all images and generate thumbs for the left column
                //print $item['view'];
                $patterns = array("/\\.jpg\$/", "/\\./");
                $replace = array('', '-');
                $className = preg_replace($patterns, $replace, $item['filename']);
                $minilink .= l(theme('imagecache', 'product_list_mini', $item['filepath']), "node/{$nid}", array('html' => TRUE, 'attributes' => array('class' => $className)));
            }
        } else {
            $imagelink = '';
        }
        $product_table .= '<div class="product-column">';
        $product_table .= '<div class="product-flags">';
        if (in_array(7, array_keys($product->taxonomy))) {
            // checks to see if item is novita by taxonomy
            $product_table .= '<div class="lotus_flags new">&nbsp;</div>';
        }
        if (in_array(29, array_keys($product->taxonomy))) {
            // checks to see if item is offerta by taxonomy
            $product_table .= '<div class="lotus_flags offer">&nbsp;</div>';
        }
        if ($product->field_esclusiva[0]['value']) {
            // checks to see if item is exclusive by cck field
            $product_table .= '<div class="lotus_flags exclusive">&nbsp;</div>';
        }
        $product_table .= '</div>';
        if (variable_get('uc_catalog_grid_display_title', TRUE)) {
            $product_table .= '<span class="catalog-grid-title">' . $titlelink . '</span>';
        }
        $product_table .= '<span class="catalog-grid-image">' . $imagelink . '</span>';
        $product_table .= '<div class="details-holder">';
        $product_table .= '<div class="details-content">';
        $product_table .= '<h3>' . t('DETTAGLI') . '</h3>';
        $product_table .= '<div>';
        if (variable_get('uc_catalog_grid_display_sell_price', TRUE) && user_access('view product version')) {
            $product_table .= '<span class="catalog-grid-sell-price">' . uc_price($product->sell_price, $context) . ' <span class="small">– prezzo netto per imballo completo</span></span>';
        }
        $product_table .= '<span class="product-desc">' . $product->body . '</span>';
        $product_table .= '</div>';
        $product_table .= '</div>';
        $product_table .= '</div>';
        $product_table .= '<div class="mini-thumbs">';
        $product_table .= '<span class="catalog-grid-image-mini">' . $minilink . '</span>';
        $product_table .= '</div>';
        $product_table .= '</div>';
        $count++;
    }
    $product_table .= ' </div>';
    $product_table .= '<div class="column middle-right">';
    $product_table .= '  <div class="filter right">';
    $product_table .= $array["pager"];
    $product_table .= ' </div>';
    $product_table .= '</div>';
    $product_table .= "</div></div></div>";
    return $product_table;
}