Your IP : 216.73.216.84


Current Path : /home/helpink/www/components/com_jbusinessdirectory/views/offer/tmpl/
Upload File :
Current File : /home/helpink/www/components/com_jbusinessdirectory/views/offer/tmpl/default_style_2.php

<?php

/**
 * @package    J-BusinessDirectory
 *
 * @author     CMSJunkie http://www.cmsjunkie.com/
 * @copyright  Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
 * @license    https://www.gnu.org/licenses/agpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');
$user = JBusinessUtil::getUser();

$session = JFactory::getSession();
$menuItem = "&Itemid=" . $session->get("offersMenuItemId");
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "";
$offerQuantity = $this->offer->quantity;

$couponUrl = JRoute::_('index.php?option=com_jbusinessdirectory&task=offer.generateCoupon&id=' . $this->offer->id);
if ($this->appSettings->enable_offer_selling && $this->offer->enable_offer_selling != OFFER_SELLING_COUPON && !empty((float)$this->offer->specialPrice) && !empty((float)$this->offer->price)) {
    $couponUrl = "javascript:onclick=jbdOffers.addToCart(" . $this->offer->id . ",1)";
}
?>

<div id="jbd-container" class="jbd-container">
    <div id="offer-details-2" class="offer-details offer-details-2" itemscope itemtype="http://schema.org/Offer">
        <div class="row mb-4">
            <?php if (!empty($referer) && false) { ?>
                <div class="col-md-3">
                    <a href="<?php echo $referer ?>"><i class="la la-angle-left"></i> <?php echo JText::_("BACK") ?></a>
                </div>
            <?php } else { ?>
                <div class="col-md-3">
                    <a href="<?php echo JRoute::_('index.php?option=com_jbusinessdirectory&view=offers&reload=1' . $menuItem); ?>"><i class="la la-angle-left"></i> <?php echo JText::_("BACK_TO_OFFERS") ?></a>
                </div>
            <?php } ?>
            <div class="col-md-9 header-icons">
                <?php require_once JPATH_COMPONENT_SITE . "/include/social_share.php" ?>
                <a class="print-icon" rel="nofollow" href="javascript:jbdUtils.printItem('<?php echo JRoute::_("index.php?option=com_jbusinessdirectory&view=offer&tmpl=component&action=print&offerId=" . $this->offer->id); ?>')"><i class="icon print-circle"></i></a>
                <?php if ($this->appSettings->enable_bookmarks && $this->offer->item_type == OFFER_TYPE_OFFER) { ?>
                    <?php if (!empty($this->offer->bookmark)) { ?>
                        <!-- Business Bookmarks -->
                        <a id="bookmark-<?php echo $this->offer->id ?>" href="javascript:jbdUtils.showUpdateBookmarkDialog(<?php echo $user->id == 0 ? "1" : "0" ?>, <?php echo $this->offer->id ?>,<?php echo BOOKMARK_TYPE_OFFER ?>)" title="<?php echo JText::_("LNG_UPDATE_BOOKMARK") ?>" class="bookmark"><i class="icon heart-circle"></i></a>
                    <?php } else { ?>
                        <a id="bookmark-<?php echo $this->offer->id ?>" href="javascript:jbdUtils.showAddBookmark(<?php echo $user->id == 0 ? "1" : "0" ?>, <?php echo $this->offer->id ?>,<?php echo BOOKMARK_TYPE_OFFER ?>)" title="<?php echo JText::_("LNG_ADD_BOOKMARK") ?>" class="bookmark"><i class="icon heart-o-circle"></i></a>
                    <?php } ?>
                <?php } ?>
            </div>
        </div>

        <div class="row item-section mb-0">
            <?php if (!empty($this->offer->pictures)) { ?>
                <div class="col-lg-8">
                    <?php
                    $this->pictures = $this->offer->pictures;
                    require_once JPATH_COMPONENT_SITE . '/include/gallery/image_gallery_vertical.php';
                    ?>
                </div>
            <?php } ?>

            <div class="col-lg-4">
                <div class="offer-main-info">
                    <h1 itemprop="name" class="pt-0"> <?php echo $this->escape($this->offer->subject) ?></h1>
                    <span style="display:none;" itemprop="url"><?php echo JBusinessUtil::getOfferLink($this->offer->id, $this->offer->alias); ?></span>

                    <div class="rating-info">
                        <div class="rating rating-stars">
                            <span class="user-rating-avg rating-average-review" id="rating-average-review" title="<?php echo $this->offer->review_score ?>" alt="<?php echo $this->offer->id ?>" style="display: block;"></span>
                        </div>
                        <?php echo count($this->reviews) . " " . JText::_("LNG_REVIEWS") ?> &nbsp; | &nbsp; <a class="" href="javascript:void(0)" onclick="jbdReviews.addNewReview(<?php echo ($appSettings->enable_reviews_users && $user->id == 0) ? "1" : "0" ?>,false)"><?php echo JText::_("LNG_WRITE_REVIEW") ?></a>
                    </div>

                    <?php
                    if (!empty($this->offer->price)) :
                        $originalPrice = (float) $this->offer->price;
                        $discountedPrice = !empty($this->offer->specialPrice) ? (float) $this->offer->specialPrice : null;

                        if ($discountedPrice && $originalPrice > 0) {
                            $discountPercentage = round((($originalPrice - $discountedPrice) / $originalPrice) * 100);
                        }
                    ?>

                        <div class="price-container">
                            <?php if ($discountedPrice) : ?>
                                <!-- Discount Badge -->
                                <div class="discount-wrapper">
                                    <div class="discount-badge">
                                        <span class="discount-icon">%</span>
                                    </div>
                                    <div class="discount-value"><?php echo $discountPercentage > 0 ? '-' . $discountPercentage . '%' : '-'; ?></div>
                                </div>

                                <!-- Strikethrough Original Price with Currency -->
                                <div class="original-price">
                                    <span class="price"><?php echo JBusinessUtil::getPriceFormat($originalPrice, $this->offer->currencyId); ?></span>
                                </div>

                                <!-- Special Price -->
                                <div class="special-price">
                                    <span class="price"><?php echo JBusinessUtil::getPriceFormat($discountedPrice, $this->offer->currencyId); ?></span>
                                </div>
                            <?php else : ?>
                                <!-- Only the regular price if there's no special price -->
                                <div class="regular-price">
                                    <span class="price"><?php echo JBusinessUtil::getPriceFormat($originalPrice, $this->offer->currencyId); ?></span>
                                </div>
                            <?php endif; ?>
                        </div>

                        <?php if ($this->defaultAttributes["price_text"] != ATTRIBUTE_NOT_SHOW) { ?>
                            <?php if ($this->defaultAttributes["price_text"] != ATTRIBUTE_NOT_SHOW) { ?>
                                <?php if (!empty($this->offer->price_text)) { ?>
                                    <div class="price-text"><?php echo $this->offer->price_text; ?></div>
                                <?php } elseif (empty($this->offer->price) && empty($this->offer->specialPrice) && ($this->appSettings->show_offer_free)) { ?>
                                    <div><span class="free-text text-success p-2"><?php echo JText::_('LNG_FREE') ?></span></div>
                                <?php } ?>
                            <?php } ?>
                        <?php } ?>
                    <?php endif; ?>

                    <?php if ($this->offer->item_type == OFFER_TYPE_OFFER && (!$this->appSettings->enable_offer_selling || $this->appSettings->enable_offer_selling && $this->offer->enable_offer_selling == OFFER_SELLING_COUPON)) { ?>
                        <div class="jbd-coupon">
                            <?php if (!empty($this->offer->specialPrice) && !empty($this->offer->price) && $this->offer->specialPrice < $this->offer->price) { ?>
                                <div class="jbd-coupon-discount">
                                    <?php echo JBusinessUtil::getPriceDiscount($this->offer->specialPrice, $this->offer->price) ?>% </span> <?php echo JText::_("LNG_OFF") ?>
                                </div>
                            <?php } ?>
                            <?php if ($this->appSettings->enable_offer_coupons) { ?>
                                <?php if ($this->offer->checkOffer) { ?>
                                    <div class="jbd-coupon-link">
                                        <div class="jbtn-offer-darken"></div>
                                        <?php if ($user->id != 0) { ?>
                                            <a href="<?php echo $couponUrl ?>">
                                                <?php echo JText::_("LNG_GENERATE_COUPON") ?>
                                            </a>
                                        <?php } else { ?>
                                            <a href="javascript:jbdUtils.showLoginNotice()">
                                                <?php echo JText::_('LNG_GENERATE_COUPON') ?>
                                            </a>
                                        <?php } ?>
                                    </div>
                                <?php } ?>
                            <?php } ?>
                        </div>
                    <?php } ?>

                    <div class="row">
                        <div class="col-lg">
                            <div class="offer-info">
                            <ul class="item-details">
                                    <?php if (!empty($this->offer->show_time) && JBusinessUtil::getRemainingtime($this->offer->endDate, $this->offer->time_zone, true) != "") { ?>
                                        <li>
                                            <div class="icon-wrapper"><i class="la la-clock-o"></i></div> <?php echo JBusinessUtil::getRemainingtime($this->offer->endDate, $this->offer->time_zone, true) ?>
                                        </li>
                                    <?php } ?> 

                                    <?php if ((!empty($this->offer->startDate) && $this->offer->startDate!="0000-00-00") || (!empty($this->offer->endDate) && $this->offer->endDate!="0000-00-00")) { ?>
                                        <li>
                                            <div class="icon-wrapper"><i class="icon calendar"></i></div>
                                            <?php
                                                echo  JBusinessUtil::getDateGeneralFormat($this->offer->startDate)." - ". JBusinessUtil::getDateGeneralFormat($this->offer->endDate);
                                            ?>
                                            <span style="display: none;" itemprop="validFrom"><?php echo JBusinessUtil::getDateGeneralFormat($this->offer->startDate)?></span>
                                            <span style="display: none;" itemprop="validThrough"><?php echo JBusinessUtil::getDateGeneralFormat($this->offer->endDate)?></span>
                                        </li>
                                    <?php } ?>
                                    
                                    <?php if ($this->appSettings->show_contact_form && $this->offer->item_type == OFFER_TYPE_OFFER) { ?>
                                        <?php if(!empty($this->offer->company->phone) || !empty($this->offer->company->mobile)){?>
                                            <li>
                                                <?php if(!empty($this->offer->company->phone)){ ?>
                                                    <div class="icon-wrapper"><i class="icon phone-o"></i></div> <a href="tel:<?php  echo $this->escape($this->offer->company->phone); ?>"><?php  echo $this->escape($this->offer->company->phone); ?></a> &nbsp;&nbsp;
                                                <?php } else if(!empty($this->offer->company->mobile)){ ?>
                                                    <div class="icon-wrapper"><i class="icon mobile"></i></div> <a href="tel:<?php  echo $this->escape($this->offer->company->mobile); ?>"><?php  echo $this->escape($this->offer->company->mobile); ?></a>
                                                <?php } ?>
                                            </li>
                                        <?php } ?>
                                    <?php } ?>
                                    
                                    <?php $address = JBusinessUtil::getAddressText($this->offer); ?>
                                    <?php if (!empty($address)) { ?>
                                        <li>
                                            <div class="icon-wrapper"><i class="icon calendar"></i></div><span itemprop="address"><?php echo $this->escape($address) ?></span>
                                            <?php if (isset($this->offer->latitude) && isset($this->offer->longitude)) {
                                                $location = new stdClass;
                                                $location->latitude = $this->offer->latitude;
                                                $location->longitude = $this->offer->longitude;
                                            ?>
                                                <a target="_blank" href="<?php echo JBusinessUtil::getDirectionURL(null, $location) ?>"><i class="icon map-direction"></i></a>
                                            <?php } ?>
                                        </li>
                                    <?php } ?>

                                    <?php if($appSettings->enable_offer_reporting){?>
                                        <li>
                                            <div class="icon-wrapper"><i class="la la-flag"></i></div><a href="javascript:jbdOffers.showReportOfferAbuse()"> <?php echo JText::_('LNG_REPORT_OFFER'); ?></a>
                                        </li>
                                    <?php } ?>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <?php if (
                        $this->appSettings->enable_offer_selling && $this->offer->enable_offer_selling == OFFER_SELLING_REGULAR && JBusinessUtil::checkDateInterval($this->offer->startDate, $this->offer->endDate) && $this->offer->quantity > 0
                        && (isset($this->offer->companyPackage->features) && in_array(SELL_OFFERS, $this->offer->companyPackage->features) || !$this->appSettings->enable_packages)
                    ) { ?>
                        <div class="jbtn-order">
                            <div class="jbtn-order-info <?php echo !empty($this->offer->sellingOptions) ? "vertical" : "" ?>">
                                <?php if (!empty($this->offer->sellingOptions)) {
                                    echo AttributeService::renderSellingAttributesFront($this->offer->sellingOptions, $this->offer->id, $this->offer->main_subcategory);
                                } else { ?>
                                    <select onchange="jbdOffers.checkAddToCartStatus()" name="quantity" id="quantity" class="select">
                                        <?php
                                        if ($this->offer->min_purchase > 0) {
                                            echo '<option value="0">0</option>';
                                        }

                                        $maximum = $this->offer->max_purchase;
                                        if ($this->offer->quantity < $this->offer->max_purchase) {
                                            $maximum = $this->offer->quantity;
                                        }
                                        $maximum = ($maximum < MAXIMUM_OFFER_QUANTITY_SELLING) ? $maximum : MAXIMUM_OFFER_QUANTITY_SELLING;
                                        for ($i = $this->offer->min_purchase; $i <= $maximum; $i++) {
                                            echo '<option value="' . $i . '">' . $i . '</option>';
                                        }
                                        ?>
                                    </select>
                                <?php } ?>
                            </div>
                            <input type="hidden" id="firstValue" value="" />

                            <div class="jbtn-order-btn">
                                <a id="addToCartButton" href="javascript:onclick=jbdOffers.addToCart(<?php echo $this->offer->id; ?>)"><i class="icon cart white"></i> <?php echo JText::_('LNG_ADD_TO_CART'); ?></a>
                            </div>
                            <?php if (!empty($this->cart["items"]) && in_array($this->offer->id, array_column($this->cart["items"], 'id')) && false) { ?>
                                <div class="jbtn-order-btn ml-2 btn-remove-cart">
                                    <a id="removeFromCartButton" href="javascript:onclick=jbdOffers.removeFromCart('<?php echo $this->offer->id; ?>_')"><i class="la la-trash-o white"></i></a>
                                </div>
                            <?php } ?>
                        </div>
                    <?php } else if (
                        $this->appSettings->enable_offer_selling && $this->offer->enable_offer_selling == OFFER_SELLING_REGULAR && JBusinessUtil::checkDateInterval($this->offer->startDate, $this->offer->endDate) && $this->offer->quantity == 0
                        && (isset($this->offer->companyPackage->features) && in_array(SELL_OFFERS, $this->offer->companyPackage->features) || !$this->appSettings->enable_packages)
                    ) { ?>
                        <?php $offerQuantity = 0; ?>
                        <div class="offer-quantity-info">
                            <?php echo JText::_('LNG_OUT_OF_STOCK') ?>
                        </div>
                    <?php } ?>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-8">
                <!-- Item details -->
                <div class="item-section" itemprop="offeredBy" itemscope itemtype="http://schema.org/Organization">
                    <?php if (!empty($this->offer->company)) { ?>
                        <div class="offer-business">
                            <div class="business-details-container">
                                <?php if (isset($this->offer->companyPackage->features) && in_array(SHOW_COMPANY_LOGO, $this->offer->companyPackage->features) || !$appSettings->enable_packages) { ?>
                                    <div class="business-logo">
                                        <?php if (!empty($this->offer->company->logoLocation)) { ?>
                                            <img src="<?php echo BD_PICTURES_PATH . $this->offer->company->logoLocation ?>" alt="<?php echo $this->offer->company->name ?>">
                                        <?php } else { ?>
                                            <img src="<?php echo BD_PICTURES_PATH . '/no_image.jpg' ?>" alt="<?php echo !empty($this->offer->company) ? $this->offer->company->name : "" ?>">
                                        <?php } ?>
                                    </div>
                                <?php } ?>

                                <div class="business-details">
                                    <p class="small"><?php echo JText::_("LNG_SOLD_BY")?></p>
                                    <a class="business-name" <?php echo $newTab; ?> href="<?php echo JBusinessUtil::getCompanyLink($this->offer->company) ?>"><span itemprop="name"><?php echo $this->escape($this->offer->company->name) ?></span></a>
                                    <div class="rating rating-stars">
                                        <span class="user-rating-avg rating-average-review" id="rating-average-review" title="<?php echo $this->offer->company->review_score ?>" style="display: block;"></span>
                                    </div>
                                </div>
                            </div>
                            <div class="business-actions">
                                <?php if (!empty($this->offer->company->phone) || !empty($this->offer->company->mobile)) { ?>
                                    <?php $phone = !empty($this->offer->company->mobile) ? $this->offer->company->mobile : $this->offer->company->phone; ?>
                                    <div class="business-item" itemprop="telephone">
                                        <i class="icon phone-circle"></i> <a href="tel:<?php echo $this->escape($phone); ?>">
                                    </div>
                                <?php } ?>

                                <?php if ($this->appSettings->show_contact_form && $this->offer->item_type == OFFER_TYPE_OFFER) { ?>
                                    <div class="business-item"><a itemprop="email" href="javascript:jbdListings.contactCompany(<?php echo $showData ? 1 : 0 ?>)"><i class="icon envelope-circle"></i></a>
                                    </div>
                                <?php } ?>

                                <?php if (!empty($this->offer->company->website)) { ?>
                                    <div class="business-item" itemprop="url">
                                        <a target="_blank" itemprop="url" title="<?php echo $this->escape($this->offer->company->name) ?> Website" onclick="jbdUtils.registerStatAction(<?php echo $this->offer->company->id ?>,<?php echo STATISTIC_ITEM_BUSINESS ?>,<?php echo STATISTIC_TYPE_WEBSITE_CLICK ?>)" href="<?php echo $this->escape($this->offer->company->website) ?>"><i class="icon link-circle"></i></a>
                                    </div>
                                <?php } ?>
                            </div>
                        </div>
                    <?php } ?>
                </div>
            </div>

            <!-- Content boxes -->
            <div class="col-lg-4">
                <?php if (!empty($this->offer->paymentMethods)) { ?>
                    <div class="offer-info offer-payment-methods">
                        <div class="section-title">
                            <?php echo JText::_("LNG_AVAILABLE_PAYMENT_METHODS") ?>
                        </div>
                        <ul class="p-0">
                            <?php foreach ($this->offer->paymentMethods as $method) { ?>
                                <li><img width="40px" class="payment-icon mr-2" src="<?php echo BD_ASSETS_FOLDER_PATH . "images/payment/" . strtolower($method->type) . '.gif' ?>" /><?php echo $method->name ?></li>
                            <?php } ?>
                        </ul>
                    </div>
                <?php } ?>
            </div>
        </div>

        <div class="row item-section">
            <div class="col-lg">
                <div class="section-title">
                    <?php echo JText::_("LNG_DESCRIPTION") ?>
                </div>
                <div itemprop="description">
                    <?php echo JHTML::_("content.prepare", $this->offer->description); ?>
                </div>
            </div>
        </div>

        <div class="row item-section">
       		<div class="col categories-wrapper">
                <?php if(!empty($this->offer->categories)){
                    foreach($this->offer->categories as $i=>$category){
                        ?>
                        <a href="<?php echo JBusinessUtil::getOfferCategoryLink($category[0], $category[2]) ?>"><?php echo $this->escape($category[1]) ?></a><?php echo $i<(count($this->offer->categories)-1)? '':'' ?>
                        <?php
                    }
                } ?>
           </div>
        </div>

        <?php if(!empty($this->offer->offerType)){?>
            <div class="row item-section">
                <div class="col">
                    <?php echo JText::_("LNG_TYPE")?>
                    <strong><?php echo $this->escape($this->offer->offerType)?></strong>
                </div>
            </div>
        <?php } ?>

        <?php require_once 'offer_attributes.php'; ?>

          <!-- Attachments -->
          <?php if ($this->appSettings->enable_attachments) { ?>
            <?php if (!empty($this->offer->attachments)) { ?>
                <div class="row item-section">
                    <div class="col-12">
                        <div class="section-title">
                            <?php echo JText::_("LNG_ATTACHMENTS") ?>
                        </div>
                        <?php require "offer_attachments.php" ?>
                    </div>
                </div>
            <?php } ?>
        <?php } ?>

        <?php if (!empty($this->videos)) { ?>
        	<div class="row item-section">
        		<div class="col">
                    <div class="section-title">
                        <?php echo JText::_("LNG_VIDEOS") ?>
                    </div>
            	    <?php require_once 'offer_videos.php';?>
            	</div>
        	</div>
        <?php } ?>

        <?php if ((!empty($this->offer->latitude) && !empty($this->offer->longitude)) || $this->offer->item_type == OFFER_TYPE_PRODUCT) { ?>
            <div class="row item-section">
                <div class="col-12">
                    <div id="offer-map">
                        <?php require_once 'map.php'; ?>
                    </div>
                </div>
            </div>
        <?php } ?>

        <?php if ($this->appSettings->enable_reviews && $this->offer->item_type == OFFER_TYPE_OFFER) { ?>
            <div class="row item-section" style="background: #fff;">
                <div class="col">
                    <?php require_once 'offer_reviews.php'; ?>
                </div>
            </div>
        <?php } ?>

        <div class="row item-section">
            <div class="col-12">
                <?php
                $modules = JModuleHelper::getModules("related-offers");
                foreach ($modules as $module) {
                    echo  JModuleHelper::renderModule($module, array("style" => "xhtml"));
                }
                ?>
            </div>
        </div>

        <?php require_once 'offer_util.php'; ?>
        <?php require_once JPATH_COMPONENT_SITE . '/include/bookmark_utils.php'; ?>
    </div>
</div>