Example #1
0
<ul class="category">
<li><a href="' . get_remove(array('type', 'page')) . '">Coupons</a></li>';
        if (theme_has_products()) {
            echo '<li class="active">Products</li>';
        }
        echo '</ul>

</div>';
        if ($pagination['results']) {
            foreach (wall_products(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : '')) as $item) {
                echo '<article class="array_item product">

<div class="table">

<div class="left">
<img src="' . product_avatar($item->image) . '" alt="">
<span class="rating"><span style="width:' . $item->stars * 16 . 'px;"></span></span>
<a href="' . $item->store_reviews_link . '">' . $item->reviews . ' reviews</a>';
                echo !empty($item->cashback) ? '<span class="cashback-points" data-ttip="Great! Purchase this product and you\'ll receive ' . $item->cashback . ' points.">' . $item->cashback . '</span> ' : '';
                echo '</div>

<div class="right">
<a href="' . $item->link . '" class="title">' . $item->title . '</a>';
                if (!empty($item->price)) {
                    echo '<div class="price_info">Price: <span class="price">' . (empty($item->old_price) ? '' : '<span>' . price_format($item->old_price) . '</span>') . price_format($item->price) . ' ' . $item->currency . '</span></div>';
                }
                echo 'More products for <a href="' . get_update(array('type' => 'products'), $item->store_link) . '">' . $item->store_name . '</a>
<div class="description">' . (!empty($item->description) ? nl2br($item->description) : 'no description') . '</div>

<ul class="details">
<li>Product Added: <b>' . timeago(strtotime($item->date), 'seconds') . ' ago</b></li>';
Example #2
0
function edit_product_form($id)
{
    global $LANG;
    if ($GLOBALS['me']) {
        if ($GLOBALS['me']->Stores > 0) {
            $product = \query\main::product_infos($id);
            if ($product->userID !== $GLOBALS['me']->ID) {
                return '<div class="info_form">' . $LANG['edit_prod_cant'] . '</div>';
            }
            /* */
            $product_image = $product->image;
            $form = '<div class="edit_product_form other_form">';
            if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit_product_form']) && \site\utils::check_csrf($_POST['edit_product_form']['csrf'], 'edit_coupon_csrf')) {
                $pd = \site\utils::validate_user_data($_POST['edit_product_form']);
                try {
                    $post_info = \user\main::edit_product($id, $GLOBALS['me']->ID, $pd);
                    $product_image = $post_info->image;
                    $form .= '<div class="success">' . $LANG['edit_cou_success'] . '</div>';
                } catch (Exception $e) {
                    $form .= '<div class="error">' . $e->getMessage() . '</div>';
                }
            }
            $csrf = $_SESSION['edit_coupon_csrf'] = \site\utils::str_random(12);
            $form .= '<form method="POST" action="#" enctype="multipart/form-data">
  <div class="form_field"><label for="edit_product_form[store]">' . $LANG['submit_prod_addto'] . ':</label>
  <div><select name="edit_product_form[store]" id="edit_product_form[store]">';
            foreach (stores_custom(array('user' => $GLOBALS['me']->ID, 'max' => 0)) as $v) {
                $form .= '<option value="' . $v->ID . '"' . (!isset($pd['store']) && $product->storeID == $v->ID || isset($pd['store']) && $pd['store'] == $v->ID ? ' selected' : '') . '>' . $v->name . '</option>';
            }
            $form .= '</select></div>
  </div>
  <div class="form_field"><label for="edit_product_form[name]">' . $LANG['form_name'] . ':</label> <div><input type="text" name="edit_product_form[name]" id="edit_product_form[name]" value="' . (isset($pd['name']) ? $pd['name'] : $product->title) . '" placeholder="' . $LANG['submit_prod_name_ph'] . '" required /></div></div>
  <div class="form_field"><label for="edit_product_form[price]">' . $LANG['form_price'] . ':</label> <div><input type="text" name="edit_product_form[price]" id="edit_product_form[price]" value="' . (isset($pd['price']) ? $pd['price'] : (empty($product->price) ? '' : $product->price)) . '" placeholder="' . $LANG['submit_prod_price_ph'] . '" /></div></div>
  <div class="form_field"><label for="edit_product_form[old_price]">' . $LANG['form_old_price'] . ':</label> <div><input type="text" name="edit_product_form[old_price]" id="edit_product_form[old_price]" value="' . (isset($pd['old_price']) ? $pd['old_price'] : (empty($product->old_price) ? '' : $product->old_price)) . '" placeholder="' . $LANG['submit_prod_oldprice_ph'] . '" /></div></div>
  <div class="form_field"><label for="edit_product_form[currency]">' . $LANG['form_currency'] . ':</label> <div><input type="text" name="edit_product_form[currency]" id="edit_product_form[currency]" value="' . (isset($pd['currency']) ? $pd['currency'] : $product->currency) . '" /></div></div>
  <div class="form_field"><label for="edit_product_form[url]">' . $LANG['form_product_url'] . ':</label> <div><input type="text" name="edit_product_form[url]" id="edit_product_form[url]" value="' . (isset($pd['url']) ? $pd['url'] : $product->url) . '" placeholder="' . $LANG['submit_cou_url_ph'] . '" /></div></div>
  <div class="form_field"><label for="edit_product_form[description]">' . $LANG['form_description'] . ':</label> <div><textarea name="edit_product_form[description]" id="edit_product_form[description]" style="height:100px;">' . (isset($pd['description']) ? $pd['description'] : $product->description) . '</textarea></div></div>
  <div class="form_field"><label for="edit_product_form[tags]">' . $LANG['form_tags'] . ':</label> <div><input type="text" name="edit_product_form[tags]" id="edit_product_form[tags]" value="' . (isset($pd['tags']) ? $pd['tags'] : $product->tags) . '" /></div></div>
  <div class="form_field"><label for="edit_product_form_image">' . $LANG['form_image'] . ':</label> <div><img src="' . product_avatar($product_image) . '" alt="" style="width:90px; height:90px;" /> <input type="file" name="edit_product_form_image" id="edit_product_form_image" />
  <span>Note:* max width: 800px, max height: 800px.</span></div></div>
  <div class="form_field"><label for="edit_product_form[start]">' . $LANG['form_start_date'] . ':</label> <div><input type="date" name="edit_product_form[start]" id="edit_product_form[start]" value="' . (isset($pd['start']) ? $pd['start'] : date('Y-m-d', strtotime($product->start_date))) . '" style="width: 79%; margin-right: 1%;" /><input type="time" name="edit_product_form[start_hour]" value="' . (isset($pd['start_hour']) ? $pd['start_hour'] : date('H:i', strtotime($product->start_date))) . '" style="width: 20%" /></div></div>
  <div class="form_field"><label for="edit_product_form[end]">' . $LANG['form_end_date'] . ':</label> <div><input type="date" name="edit_product_form[end]" id="edit_product_form[end]" value="' . (isset($pd['end']) ? $pd['end'] : date('Y-m-d', strtotime($product->expiration_date))) . '" style="width: 79%; margin-right: 1%;" /><input type="time" name="edit_product_form[end_hour]" value="' . (isset($pd['end_hour']) ? $pd['end_hour'] : date('H:i', strtotime($product->expiration_date))) . '" style="width: 20%" /></div></div>
  <input type="hidden" name="edit_product_form[csrf]" value="' . $csrf . '" />
  <button>' . $LANG['edit_prod_button'] . '</button>
  </form>

  </div>';
            return $form;
        } else {
            return '<div class="info_form">' . $LANG['unavailable_form2'] . '</div>';
        }
    } else {
        return '<div class="info_form">' . $LANG['unavailable_form'] . '</div>';
    }
}
Example #3
0
<?php

echo '<div class="widget widget_products_v2' . (!$mobile_view ? ' mobile_view' : '') . '">';
if (!empty($title)) {
    echo '<h2>' . $title . '</h2>';
}
echo '<ul class="list">';
foreach (products_custom(array('show' => !empty($type) ? $type : '', 'orderby' => !empty($order) ? $order : '', 'max' => !empty($limit) ? $limit : 10)) as $id) {
    echo '<li><a href="' . $id->link . '"><img src="' . product_avatar($id->image) . '" alt="" />  <span>' . $id->title . '</span></a></li>';
}
echo '</ul>
</div>';