Exemplo n.º 1
0
 /**
  * [action_form] generates the form to pay at paypal
  */
 public function action_pay()
 {
     $this->auto_render = FALSE;
     $order_id = $this->request->param('id');
     $order = new Model_Order();
     $order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
     if ($order->loaded()) {
         // case when selling advert
         if ($order->id_product == Model_Order::PRODUCT_AD_SELL) {
             $paypal_account = $order->ad->paypal_account();
             $currency = i18n::get_intl_currency_symbol();
             if (isset($order->ad->cf_shipping) and Valid::numeric($order->ad->cf_shipping) and $order->ad->cf_shipping > 0) {
                 $order->amount = $order->amount + $order->ad->cf_shipping;
             }
         } else {
             $paypal_account = core::config('payment.paypal_account');
             $currency = core::config('payment.paypal_currency');
         }
         $paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
         $paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => $paypal_account, 'paypal_currency' => $currency, 'item_name' => $order->description);
         $this->template = View::factory('paypal', $paypal_data);
         $this->response->body($this->template->render());
     } else {
         Alert::set(Alert::INFO, __('Order could not be loaded'));
         $this->redirect(Route::url('default'));
     }
 }
Exemplo n.º 2
0
<?php

defined('SYSPATH') or die('No direct script access.');
?>

<script type="application/ld+json">
<?php 
$structured_data = ['@context' => 'http://schema.org/', '@type' => 'Product', 'name' => $ad->title];
if ($ad->get_first_image() !== NULL) {
    $structured_data['image'] = $ad->description;
}
if (Core::config('advertisement.description') != FALSE) {
    $structured_data['description'] = $ad->description;
}
if ($ad->price > 0) {
    $structured_data['offers'] = ['@type' => 'Offer', 'priceCurrency' => i18n::get_intl_currency_symbol(), 'price' => $ad->price];
    if (Core::config('payment.stock') and $ad->stock > 0) {
        $structured_data['offers']['availability'] = 'http://schema.org/InStock';
    }
}
if (Core::config('advertisement.reviews') == 1 and $ad->rate !== NULL) {
    $structured_data['aggregateRating'] = ['@type' => 'AggregateRating', 'ratingValue' => $ad->rate];
}
echo json_encode($structured_data);
?>
</script>
Exemplo n.º 3
0
<?php

defined('SYSPATH') or die('No direct script access.');
?>

<script type="application/ld+json">
<?php 
$structured_data = ['@context' => 'http://schema.org/', '@type' => 'Product', 'name' => $ad->title];
if ($ad->get_first_image() !== NULL) {
    $structured_data['image'] = $ad->get_first_image();
}
if (Core::config('advertisement.description') != FALSE) {
    $structured_data['description'] = $ad->description;
}
if ($ad->price > 0) {
    $structured_data['offers'] = ['@type' => 'Offer', 'priceCurrency' => i18n::get_intl_currency_symbol() ? i18n::get_intl_currency_symbol() : 'USD', 'price' => number_format($ad->price, 2, ".", "")];
    if (Core::config('payment.stock') and $ad->stock > 0) {
        $structured_data['offers']['availability'] = 'http://schema.org/InStock';
    }
}
if (Core::config('advertisement.reviews') == 1 and $ad->rate !== NULL) {
    $structured_data['aggregateRating'] = ['@type' => 'AggregateRating', 'ratingValue' => $ad->rate, 'ratingCount' => Model_Review::get_ad_count_rates($ad)];
}
echo json_encode($structured_data);
?>
</script>