Пример #1
0
     mkdir($path, 0755);
 }
 if (isset($_GET['order'])) {
     $order = $_GET['order'];
 } else {
     $order = $_GET['key'];
 }
 $tempPath = explode(':', $order);
 $path = $path . DS . $tempPath[1];
 if (!file_exists($path)) {
     mkdir($path, 0755);
 }
 $setting = $dg->getSetting();
 include_once ROOT . DS . 'includes' . DS . 'addons.php';
 $addons = new addons();
 $addons->view('hooks' . DS . 'download');
 $file_name = $position . '-' . rand() . '.svg';
 $dg->WriteFile($path . DS . $file_name, $svg);
 if ($file == 'svg') {
     if (!empty($_GET['download'])) {
         // zip files
         if (count($files)) {
             $ij = 0;
             foreach ($files as $file) {
                 $string = str_replace($dg->url(), '', $file);
                 $string = str_replace('/', DS, $string);
                 $string = dirname(ROOT) . DS . $string;
                 $array[$ij] = $string;
                 $ij++;
             }
             $files = $array;
Пример #2
0
 public function addCart($data)
 {
     // get data post
     $product_id = $data['product_id'];
     $colors = $data['colors'];
     $print = $data['print'];
     $quantity = $data['quantity'];
     // get attribute
     if (isset($data['attribute'])) {
         $attribute = $data['attribute'];
     } else {
         $attribute = false;
     }
     if ($quantity < 1) {
         $quantity = 1;
     }
     $time = strtotime("now");
     if (isset($data['cliparts'])) {
         $cliparts = $data['cliparts'];
     } else {
         $cliparts = false;
     }
     $content = array();
     $content['error'] = 1;
     // load product
     $products = $this->getProducts();
     $product = false;
     for ($i = 0; $i < count($products); $i++) {
         if ($product_id == $products[$i]->id) {
             $product = $products[$i];
             break;
         }
     }
     if ($product === false) {
         $content['msg'] = 'Product could not be found';
     } else {
         $content['error'] = 0;
         // load cart
         include_once ROOT . DS . 'includes' . DS . 'cart.php';
         $cart = new dgCart();
         $post = array('colors' => $colors, 'print' => $print, 'attribute' => $attribute, 'quantity' => $quantity, 'product_id' => $product_id);
         // load setting
         $setting = $this->getSetting();
         include_once ROOT . DS . 'includes' . DS . 'addons.php';
         $addons = new addons();
         $params = array('data' => $data, 'product' => $product, 'setting' => $setting);
         $addons->view('hooks' . DS . 'product', $params);
         $result = $cart->totalPrice($product, $post, $setting);
         $params = array('data' => $data, 'product' => $product, 'setting' => $setting, 'result' => $result);
         $addons->view('hooks' . DS . 'fields', $params);
         $result->product = new stdClass();
         $result->product->name = $product->title;
         $result->product->sku = $product->sku;
         // get cliparts
         $clipartsPrice = array();
         if (isset($data['cliparts']) && count($data['cliparts']) > 0) {
             $clipartsPrice = $cart->getPriceArt($data['cliparts']);
         }
         $result->cliparts = $clipartsPrice;
         $total = new stdClass();
         $total->old = $result->price->colors + $result->price->prints;
         $print_discount = 0;
         // 2015.11.21
         if (isset($result->price->print_discount)) {
             $print_discount = $result->price->print_discount;
         }
         // 2015.11.21
         $total->sale = $result->price->colors + $result->price->prints - $print_discount;
         // 2015.11.21
         if (count($result->cliparts)) {
             foreach ($result->cliparts as $id => $amount) {
                 $total->old = $total->old + $amount;
                 $total->sale = $total->sale + $amount;
             }
         }
         if (empty($result->price->attribute)) {
             $result->price->attribute = 0;
         }
         $total->old = ($total->old + $result->price->attribute) * $quantity;
         $total->sale = ($total->sale + $result->price->attribute) * $quantity;
         $result->total = $total;
         // get symbol
         if (!isset($setting->currency_symbol)) {
             $setting->currency_symbol = '$';
         }
         $result->symbol = $setting->currency_symbol;
         // save file image design
         $path = $this->folder();
         $design = array();
         $design['images'] = array();
         if (isset($data['design']['images']['front'])) {
             $design['images']['front'] = $this->createFile($data['design']['images']['front'], $path, 'cart-front-' . $time);
         }
         if (isset($data['design']['images']['back'])) {
             $design['images']['back'] = $this->createFile($data['design']['images']['back'], $path, 'cart-back-' . $time);
         }
         if (isset($data['design']['images']['left'])) {
             $design['images']['left'] = $this->createFile($data['design']['images']['left'], $path, 'cart-left-' . $time);
         }
         if (isset($data['design']['images']['right'])) {
             $design['images']['right'] = $this->createFile($data['design']['images']['right'], $path, 'cart-right-' . $time);
         }
         if (empty($result->options)) {
             $result->options = array();
         }
         if (isset($data['teams'])) {
             $teams = $data['teams'];
         } else {
             $teams = '';
         }
         $params = array('data' => $data, 'result' => $result, 'design' => $design, 'setting' => $setting);
         $addons->view('hooks' . DS . 'cart', $params);
         // add cart
         $item = array('id' => $result->product->sku, 'product_id' => $data['product_id'], 'qty' => $data['quantity'], 'teams' => $teams, 'price' => $result->total->sale, 'prices' => json_encode($result->price), 'cliparts' => json_encode($result->cliparts), 'symbol' => $result->symbol, 'customPrice' => $result->price->attribute, 'name' => $result->product->name, 'time' => $time, 'options' => $result->options);
         $rowid = md5($result->product->sku . $time);
         $cache = $this->cache('cart');
         $designs = array('color' => $data['colors'][key($data['colors'])], 'images' => $design['images'], 'vector' => $data['design']['vectors'], 'fonts' => $data['fonts'], 'item' => $item);
         $cache->set($rowid, $designs);
         $price_product = $result->total->sale / $quantity;
         $content['product'] = array('rowid' => $rowid, 'price' => $price_product, 'quantity' => $quantity, 'color_hex' => $data['colors'][key($data['colors'])], 'color_title' => $product->design->color_title[key($data['colors'])], 'images' => json_encode($design['images']), 'teams' => $teams, 'options' => $result->options);
     }
     return $content;
 }
Пример #3
0
		<!-- END fonts -->
		
		<!-- BEGIN preview -->
		<?php 
$dg->view('modal_preview');
?>
		<!-- END preview -->
		
		<!-- BEGIN Share -->
		<?php 
$dg->view('modal_share');
?>
		<!-- END Share -->
		
		<?php 
$addons->view('modal');
?>
	</div>
	<!-- END modal -->
	
	<!-- BEGIN popover -->
	<div class="popover right" id="dg-popover">
		<div class="arrow"></div>
		<h3 class="popover-title">
			<span><?php 
echo $lang['designer_clipart_edit_size_position'];
?>
</span> 
			<a href="javascript:void(0)" class="popover-close">
				<i class="glyphicons remove_2 glyphicons-12 pull-right"></i>
			</a>
Пример #4
0
	<link type="text/css" href="assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" media="all" />
	<link type="text/css" href="assets/css/style.css" rel="stylesheet" media="all">
	<link type="text/css" href="assets/css/admin.css" rel="stylesheet" media="all">
	<link type="text/css" href="assets/plugins/perfect-scrollbar/perfect-scrollbar.css" rel="stylesheet" media="all">
	<link rel="shortcut icon" href="media/assets/icon.png" />
	
	<?php 
echo $addons->css();
?>
	
	<script type="text/javascript" src="assets/js/jquery.min.js"></script>
	<script type="text/javascript" src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
	<script type="text/javascript" src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
	
	<?php 
echo $addons->view('lang-js');
?>
	
	<script src="<?php 
echo 'assets/js/add-ons.js';
?>
"></script>
	<script src="<?php 
echo 'assets/js/jquery.ui.rotatable.js';
?>
"></script>	
	<script src="<?php 
echo 'assets/js/design-admin.js';
?>
" type="text/javascript" charset="utf-8"></script>	
	<script src="<?php