public static function at_recent_cars($atts = null, $content = null) { if ($atts == 'generator') { return array("name" => __("Recent Listings", AT_ADMIN_TEXTDOMAIN), "base" => "at_recent_cars", 'icon' => "im-icon-spinner-4", "class" => "at-recent-cars-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Description will appear below each chart.", AT_ADMIN_TEXTDOMAIN), 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "12", "min" => "0", "max" => "20", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Make", AT_ADMIN_TEXTDOMAIN), "param_name" => "manufacturer_id", "width" => 200, "value" => AT_VC_Helper::get_manufacturers(), "description" => ''), array("type" => "dropdown", "heading" => __("Model", AT_ADMIN_TEXTDOMAIN), "param_name" => "model_id", "width" => 200, "value" => array("Any" => "0"), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN)))); } $shortcode_id = self::_shortcode_id(); extract(shortcode_atts(array('title' => '', 'manufacturer_id' => 0, 'model_id' => 0, 'limit' => 12, 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts)); $width = wpb_translateColumnWidthToSpan($width); $car_model = AT_Loader::get_instance()->model('car_model'); $cars = array(); $params = array(); if ($manufacturer_id > 0) { $params['manufacturer_id'] = $manufacturer_id; if ($model_id == 0) { $params['model_id'] = $model_id; } } $cars = $car_model->get_cars($params, $offset = 0, $limit); $output = '<div class="recent ' . $el_class . '"> <h2>' . $title . '</h2> <div class="recent_carousel" data-settings=\'{ "auto": ' . $autoplay . ', "pause": ' . $pause . ', "slideWidth": 220, "minSlides": 1, "infiniteLoop": 1, "maxSlides": 4, "slideMargin": 20, "controls" : true, "pager" : false, "infiniteLoop": true }\'>'; foreach ($cars as $key => $car) { if (isset($car['photo']['photo_name']) && file_exists($car['photo']['photo_path'] . '213x164/' . $car['photo']['photo_name'])) { $static = $car['photo']['photo_url'] . '213x164/' . $car['photo']['photo_name']; $image = '<img src="' . AT_Common::static_url($static) . '" alt="' . $title . '"/>'; } else { if (has_post_thumbnail()) { $image = get_the_post_thumbnail($post_id = get_the_ID(), $size = array(213, 164)); } else { $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-small.jpg') . '" alt="' . $title . '"/>'; } } // OLD WAY: // <img src="' . AT_Common::static_url( $car['photo']['photo_path'] . '213x164/' . $car['photo']['photo_name'] ) . '" alt="' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . '"/> $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']); $output .= '<div class="slide"> <a href="' . get_permalink($car['ID']) . '"> ' . $image . ' <div class="description"> Registration ' . $car['options']['_fabrication'] . '<br/>' . (!empty($car['options']['_cilindrics']) ? $car['options']['_cilindrics'] . ' cm³ ' : '') . (!empty($car['options']['_fuel_id']['name']) ? $car['options']['_fuel_id']['name'] . '<br/>' : '') . (!empty($car['options']['_engine_power']) ? $car['options']['_engine_power'] . ' HP<br/>' : '') . (!empty($car['options']['_body_type_id']['name']) ? 'Body ' . $car['options']['_body_type_id']['name'] . '<br/>' : '') . (!empty($car['options']['_mileage']) ? number_format((int) $car['options']['_mileage'], 0, '', ' ') . ' ' . AT_Common::car_mileage(0) : '') . '</div> <div class="title">' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . ' <span class="price">' . $cost . '</span></div> </a> </div>'; } $output .= '</div> </div>'; return $output; }
<h2><?php echo __('<strong>Similar</strong> offers', AT_TEXTDOMAIN); ?> </h2> <ul> <?php foreach ($cars as $key => $car) { ?> <li<?php if ($key == 3) { echo ' class="last"'; } ?> > <?php $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']); echo ' <a href="' . get_permalink($car['ID']) . '"> <img src="' . AT_Common::static_url($car['photo']['photo_url'] . '213x164/' . $car['photo']['photo_name']) . '" alt="' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . '"/> <div class="description"> Registration ' . $car['options']['_fabrication'] . '<br/>' . (!empty($car['options']['_cilindrics']) ? $car['options']['_cilindrics'] . ' cm³ ' : '') . (!empty($car['options']['_fuel_id']['name']) ? $car['options']['_fuel_id']['name'] . '<br/>' : '') . (!empty($car['options']['_engine_power']) ? $car['options']['_engine_power'] . ' HP<br/>' : '') . (!empty($car['options']['_body_type_id']['name']) ? 'Body ' . $car['options']['_body_type_id']['name'] . '<br/>' : '') . (!empty($car['options']['_mileage']) ? number_format((int) $car['options']['_mileage'], 0, '', ' ') . ' ' . AT_Common::car_mileage(0) : '') . '</div> <div class="title">' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . ' <span class="price">' . $cost . '</span></div> </a>'; ?> </li> <?php } ?> <!-- <li class="last"> <a href="#"> <img src="<?php
public function ajax_add_offer($car_id = '') { $car_id = (int) $car_id; if (!$this->uri->is_ajax_request() || $car_id == 0) { AT_Core::show_404(); } $car_model = $this->load->model('car_model'); if (!($car_info = $car_model->get_car_info($car_id))) { AT_Core::show_404(); } try { if (!$this->validation->run('add_offer')) { throw new Exception(serialize($this->validation->get_errors())); } $mail_model = $this->load->model('mail_model'); $user_model = $this->load->model('user_model'); $owner_info = $user_model->get_user_by_id($car_info['options']['_owner_id']); $dealer_email = ''; if ($owner_info['is_dealer']) { if ($car_info['options']['_affiliate_id'] > 0) { $affiliate = $user_model->get_dealer_affiliate_by_id($car_info['options']['_affiliate_id']); } if (empty($affiliate)) { $affiliate = $user_model->get_dealer_main_affiliate($car_info['options']['_owner_id']); } if ($affiliate) { $dealer_email = $affiliate['email']; } } if (!$owner_info['is_dealer'] || $dealer_email == '') { $dealer_email = $owner_info['email']; } $cost = AT_Common::show_full_price($value = $car_info['options']['_price'], $currency = $car_info['options']['_currency_id']); $data = array('dealer_name' => $owner_info['name'], 'username' => $_POST['fullname'], 'user_email' => $_POST['email'], 'car_name' => trim($car_info['options']['_manufacturer_id']['name'] . ' ' . $car_info['options']['_model_id']['name'] . ' ' . $car_info['options']['_version']), 'cost' => $cost, 'offer_details' => $_POST['offer_details'], 'link_car' => get_permalink($car_id)); if (!$mail_model->send('template_mail_add_offer', $dealer_email, $data, $_POST['email'], $_POST['fullname'])) { throw new Exception(serialize(array('email' => __('Error send email! Try later.', AT_TEXTDOMAIN)))); } $response = array('status' => 'OK', 'message' => __('The offer was sent.', AT_TEXTDOMAIN)); } catch (Exception $e) { $response = array('status' => 'ERROR', 'message' => unserialize($e->getMessage())); } $this->view->add_json($response)->display(); }
<?php } ?> </div> <div class="car_characteristics"> <a href="#" class="print" onclick="window.print();return false;"></a> <div class="price" data-currency="<?php echo $car_info['options']['_currency_id']['name']; ?> " data-price="<?php echo $car_info['options']['_price']; ?> "> <?php if (isset($car_info['options']['_price'])) { echo AT_Common::show_full_price($value = $car_info['options']['_price'], $currency = $car_info['options']['_currency_id']); } ?> <?php if ($car_info['options']['_price_negotiable']) { ?> <span><?php echo __('* Price negotiable', AT_TEXTDOMAIN); ?> </span> <?php } ?> </div> <div class="clear"></div> <div class="features_table">
public static function at_auto_gallery($atts = null, $content = null) { if ($atts == 'generator') { return array("name" => __("Slider: Auto Gallery", AT_ADMIN_TEXTDOMAIN), "base" => "at_auto_gallery", 'icon' => "im-icon-spinner-4", "class" => "at-auto-gallery-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "5", "min" => "0", "max" => "12", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Display options", AT_ADMIN_TEXTDOMAIN), "param_name" => "display", "width" => 200, "value" => array("Show all item" => "all", "Only featured" => "featured"), "description" => ''), array("type" => "dropdown", "heading" => __("Make", AT_ADMIN_TEXTDOMAIN), "param_name" => "manufacturer_id", "width" => 200, "value" => AT_VC_Helper::get_manufacturers(), "description" => ''), array("type" => "dropdown", "heading" => __("Model", AT_ADMIN_TEXTDOMAIN), "param_name" => "model_id", "width" => 200, "value" => array_merge(array("Any" => "0"), AT_VC_Helper::get_manufacturers()), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN)))); } $shortcode_id = self::_shortcode_id(); extract(shortcode_atts(array('manufacturer_id' => 0, 'model_id' => 0, 'display' => 'all', 'limit' => 5, 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts)); $width = wpb_translateColumnWidthToSpan($width); $car_model = AT_Loader::get_instance()->model('car_model'); $cars = array(); $params = array(); if ($manufacturer_id > 0) { $params['manufacturer_id'] = $manufacturer_id; if ($model_id == 0) { $params['model_id'] = $model_id; } } if ($display == "featured") { $params['featured'] = true; } $cars = $car_model->get_cars($params, $offset = 0, $limit); if (count($cars) > 0) { $output = '<div class="home_slider ' . $el_class . '"> <div class="slider slider_1" data-settings=\'{ "auto": ' . $autoplay . ', "slideWidth": 940, "pause": ' . $pause . ', "minSlides": 1, "infiniteLoop" : true, "maxSlides": 1, "slideMargin": 0, "controls" : false}\'>'; foreach ($cars as $key => $car) { $title = $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name']; if (isset($car['photo']['photo_name']) && file_exists($car['photo']['photo_path'] . 'original/' . $car['photo']['photo_name'])) { $static = $car['photo']['photo_url'] . 'original/' . $car['photo']['photo_name']; $image = '<img src="' . AT_Common::static_url($static) . '" alt="' . $title . '"/>'; } else { if (has_post_thumbnail()) { $image = get_the_post_thumbnail($post_id = $car['ID'], $size = array(640, 428)); } else { $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-large.jpg') . '" alt="' . $title . '"/>'; } } $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']); $output .= '<div class="slide" data-onclick="location.href=' . get_permalink($car['ID']) . '"> <a title="' . $title . '" href="' . get_permalink($car['ID']) . '">' . $image . '</a> <div class="description"> <a title="' . $title . '" href="' . get_permalink($car['ID']) . '"><h2 class="title">' . $car['options']['_fabrication'] . ' ' . $title . '</h2></a> <p class="desc">' . (!empty($car['options']['_mileage']) ? '<span><strong>' . AT_Common::car_mileage(0) . ': </strong>' . number_format((int) $car['options']['_mileage'], 0, '', ',') . '</span>' : '') . (!empty($car['options']['_cilindrics']) ? '<span><strong>' . __('Engine', AT_TEXTDOMAIN) . ': </strong>' . $car['options']['_cilindrics'] . ' ' . __('cm³', AT_TEXTDOMAIN) . '</span> ' : '') . '</p> <div class="price">' . $cost . '</div> </div> </div>'; } $output .= '</div> </div>'; } else { $output = '<div class="home_slider ' . $el_class . '">' . __('Login and add new vehicles.', AT_TEXTDOMAIN) . '</div>'; } return $output; }