static function getProductArray()
 {
     $products = ORM::factory("product")->find_all();
     foreach ($products as $product) {
         $producta[$product->id] = $product->description . " (" . basket::formatMoney($product->cost) . ")";
     }
     return $producta;
 }
 static function getProductArray($id)
 {
     $producta = array();
     // check for product override
     $product_override = ORM::factory("product_override")->where('item_id', "=", $id)->find();
     if (!$product_override->loaded()) {
         // no override found so check parents
         // check parents for product override
         $item = ORM::factory("item", $id);
         $parents = $item->parents();
         foreach ($parents as $parent) {
             // check for product override
             $product_override = ORM::factory("product_override")->where('item_id', "=", $parent->id)->find();
             if ($product_override->loaded()) {
                 break;
             }
         }
     }
     $products = ORM::factory("product")->find_all();
     foreach ($products as $product) {
         $show = true;
         $cost = $product->cost;
         if ($product_override->loaded()) {
             $show = !$product_override->none;
             $item_product = ORM::factory("item_product")->where('product_override_id', "=", $product_override->id)->where('product_id', "=", $product->id)->find();
             if ($item_product->loaded()) {
                 $cost = $item_product->cost;
                 if (!$show) {
                     $show = $item_product->include;
                 }
             }
         }
         if ($show) {
             $producta[$product->id] = $product->description . " (" . basket::formatMoney($cost) . ")";
         }
     }
     return $producta;
 }
?>
"
          class="gButtonLink ui-state-default ui-corner-all ui-icon-left">
            <span class="ui-icon ui-icon-trash"></span><?php 
echo t("Remove");
?>
</a>
      </td>
  </tr>
      <? endforeach ?>
      <tr id="" class="<?php 
echo text::alternate("gOddRow", "gEvenRow");
?>
">
        <td></td><td></td><td>Total Cost</td><td><?php 
echo basket::formatMoney($total);
?>
</td><td></td>
      </tr>

   </table>
      <? else: ?>
      Shopping Basket is Empty
      <? endif; ?>

  </div>

  <? if (isset($basket->contents ) && count($basket->contents) > 0): ?>

  <? if (basket::isPaypal()): ?>
  <a href="javascript:co();"
?>
" class="<?php 
echo text::alternate("g-odd", "g-even");
?>
">
        <td id="product-<?php 
echo $product->id;
?>
" class="core-info ">
          <?php 
echo html::clean($product->name);
?>
  </td>
  <td>
    <?php 
echo basket::formatMoney($product->cost);
?>
        </td>
  <td>
    <?php 
echo html::clean($product->description);
?>
  </td>
  <td>
    <?php 
echo html::clean($product->postage_band->name);
?>
  </td>


    <td>
        <td id="product-<?php 
    echo $postage_band->id;
    ?>
" class="core-info ">
          <?php 
    echo html::clean($postage_band->name);
    ?>
  </td>
  <td>
    <?php 
    echo basket::formatMoney($postage_band->flat_rate);
    ?>
        </td>
  <td>
    <?php 
    echo basket::formatMoney($postage_band->per_item);
    ?>
  </td>
    <td class="gActions">
      <a href="<?php 
    echo url::site("admin/postage_bands/edit_postage_band_form/{$postage_band->id}");
    ?>
"
          open_text="<?php 
    echo t("close");
    ?>
"
          class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
          <span class="ui-icon ui-icon-pencil"></span><span class="gButtonText"><?php 
    echo t("edit");
    ?>
      <tr id="" class="<?php 
echo text::alternate("g-odd", "g-even");
?>
">
        <td></td><td></td><td>Postage and Packaging</td><td><?php 
echo html::clean(basket::formatMoney($postage));
?>
</td><td></td>
      </tr>
      <? endif;?>
      <tr id="" class="<?php 
echo text::alternate("g-odd", "g-even");
?>
">
        <td></td><td></td><td>Total Cost</td><td><?php 
echo html::clean(basket::formatMoney($total + $postage));
?>
</td><td></td>
      </tr>

   </table>
      <? else: ?>
      Shopping Basket is Empty
      <? endif; ?>

  </div>

  <? if (isset($basket->contents ) && count($basket->contents) > 0): ?>

  <? if (basket::isPaypal()): ?>
  <a href="javascript:co();"
?>
        </div>
        </td>
        <td>
          <?php 
echo html::clean($prod_details->product_description());
?>
        </td>
        <td>
          <?php 
echo html::clean($prod_details->quantity);
?>
        </td>
        <td>
          <?php 
echo basket::formatMoney($prod_details->cost);
?>
        </td>
    </tr>
      <? endforeach ?>
      <tr id="" class="<?php 
echo text::alternate("gOddRow", "gEvenRow");
?>
">
        <td></td><td></td><td>Total Cost</td><td><?php 
echo $basket->cost();
?>
</td>
      </tr>

   </table>
Exemple #8
0
 public function send_invoice($order)
 {
     $from = "From: " . basket::getEmailAddress();
     $ordernumber = basket::getOrderPrefix() . $order->id;
     $invoice_email = basket::replaceStrings(basket::getOrderCompleteEmail(), array("name" => $order->name, "order_number" => $ordernumber, "total_cost" => basket::formatMoney($order->cost), "order_details" => $order->text));
     mail($order->email, basket::replaceStrings(basket::getOrderCompleteEmailSubject(), array("order_number" => $ordernumber)), $invoice_email, $from);
 }
    ?>
">
        <td></td><td></td><td>Postage and Packaging</td><td><?php 
    echo html::clean(basket::formatMoney($postage));
    ?>
</td><td></td>
      </tr>
      <?php 
}
?>
      <tr id="" class="<?php 
echo text::alternate("g-odd", "g-even");
?>
">
        <td></td><td></td><td>Total Cost</td><td><?php 
echo html::clean(basket::formatMoney($basket->cost() + $postage));
?>
</td>
      </tr>
   </table>
  </div>
  <table>
  <tr><td>
<h2>Delivery Address</h2>
<?php 
echo $basket->name;
?>
<br/>
<?php 
echo $basket->house;
?>