public static function execute(ApplicationAbstract $application) { $OSCOM_Service = Registry::get('Service'); $OSCOM_Breadcrumb = Registry::get('Breadcrumb'); $review_check = false; if (is_numeric($_GET['View'])) { if (Reviews::exists($_GET['View'])) { $review_check = true; Registry::set('Product', new Product(Reviews::getProductID($_GET['View']))); $OSCOM_Product = Registry::get('Product'); $application->setPageTitle($OSCOM_Product->getTitle()); $application->setPageContent('reviews_view.php'); if ($OSCOM_Service->isStarted('Breadcrumb')) { $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, 'Reviews&View=' . $_GET['View'] . '&' . $OSCOM_Product->getKeyword())); } } } if ($review_check === false) { $application->setPageContent('reviews_not_found.php'); } }
<?php /** * osCommerce Online Merchant * * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com * @license BSD License; http://www.oscommerce.com/bsdlicense.txt */ use osCommerce\OM\Core\DateTime; use osCommerce\OM\Core\HTML; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\Site\Shop\Reviews; $Qreviews = Reviews::getEntry($_GET['View']); ?> <h1 style="float: right;"><?php echo $OSCOM_Product->getPriceFormated(true); ?> </h1> <h1><?php echo $OSCOM_Template->getPageTitle() . ($OSCOM_Product->hasModel() ? '<br /><span class="smallText">' . $OSCOM_Product->getModel() . '</span>' : ''); ?> </h1> <?php if ($OSCOM_MessageStack->exists('Reviews')) { echo $OSCOM_MessageStack->get('Reviews'); } if ($OSCOM_Product->hasImage()) { ?>
</div> <?php } if ($OSCOM_Product->getData('reviews_average_rating') > 0) { ?> <p><?php echo OSCOM::getDef('average_rating') . ' ' . HTML::image(OSCOM::getPublicSiteLink('images/stars_' . $OSCOM_Product->getData('reviews_average_rating') . '.png'), sprintf(OSCOM::getDef('rating_of_5_stars'), $OSCOM_Product->getData('reviews_average_rating'))); ?> </p> <?php } $counter = 0; $reviews_listing = Reviews::getListing($OSCOM_Product->getID()); foreach ($reviews_listing['entries'] as $r) { $counter++; if ($counter > 1) { ?> <hr style="height: 1px; width: 150px; text-align: left; margin-left: 0px" /> <?php } ?> <p><?php echo HTML::image(OSCOM::getPublicSiteLink('images/stars_' . (int) $r['reviews_rating'] . '.png'), sprintf(OSCOM::getDef('rating_of_5_stars'), (int) $r['reviews_rating'])) . ' ' . sprintf(OSCOM::getDef('reviewed_by'), HTML::outputProtected($r['customers_name'])) . '; ' . DateTime::getLong($r['date_added']); ?> </p>
<?php /* osCommerce Online Merchant $osCommerce-SIG$ Copyright (c) 2010 osCommerce (http://www.oscommerce.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation. */ use osCommerce\OM\Core\Site\Shop\Reviews; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\DateTime; $Qreviews = Reviews::getListing(); ?> <?php echo osc_image(DIR_WS_IMAGES . $OSCOM_Template->getPageImage(), $OSCOM_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"'); ?> <h1><?php echo $OSCOM_Template->getPageTitle(); ?> </h1> <?php while ($Qreviews->next()) { ?> <div class="moduleBox"> <div style="float: right; margin-top: 5px;"><?php
public static function execute(ApplicationAbstract $application) { $OSCOM_Customer = Registry::get('Customer'); $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); $OSCOM_MessageStack = Registry::get('MessageStack'); $OSCOM_Reviews = Registry::get('Reviews'); $OSCOM_Template = Registry::get('Template'); $OSCOM_Service = Registry::get('Service'); $OSCOM_Breadcrumb = Registry::get('Breadcrumb'); $requested_product = null; $product_check = false; if (count($_GET) > 3) { $requested_product = basename(key(array_slice($_GET, 3, 1, true))); if ($requested_product == 'Write') { unset($requested_product); if (count($_GET) > 4) { $requested_product = basename(key(array_slice($_GET, 4, 1, true))); } } } if (isset($requested_product)) { if (Product::checkEntry($requested_product)) { $product_check = true; } } if ($product_check === false) { $application->setPageContent('not_found.php'); return false; } if ($OSCOM_Customer->isLoggedOn() === false && SERVICE_REVIEW_ENABLE_REVIEWS == 1) { $OSCOM_NavigationHistory->setSnapshot(); OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL')); } Registry::set('Product', new Product($requested_product)); $OSCOM_Product = Registry::get('Product'); $data = array('products_id' => $OSCOM_Product->getID()); if ($OSCOM_Customer->isLoggedOn()) { $data['customer_id'] = $OSCOM_Customer->getID(); $data['customer_name'] = $OSCOM_Customer->getName(); } else { $data['customer_id'] = '0'; $data['customer_name'] = $_POST['customer_name']; } if (strlen(trim($_POST['review'])) < REVIEW_TEXT_MIN_LENGTH) { $OSCOM_MessageStack->add('Reviews', sprintf(OSCOM::getDef('js_review_text'), REVIEW_TEXT_MIN_LENGTH)); } else { $data['review'] = $_POST['review']; } if ($_POST['rating'] < 1 || $_POST['rating'] > 5) { $OSCOM_MessageStack->add('Reviews', OSCOM::getDef('js_review_rating')); } else { $data['rating'] = $_POST['rating']; } if ($OSCOM_MessageStack->size('Reviews') < 1) { if ($OSCOM_Reviews->isModerated()) { $data['status'] = '0'; $OSCOM_MessageStack->add('Reviews', OSCOM::getDef('success_review_moderation'), 'success'); } else { $data['status'] = '1'; $OSCOM_MessageStack->add('Reviews', OSCOM::getDef('success_review_new'), 'success'); } Reviews::saveEntry($data); OSCOM::redirect(OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getID())); } $application->setPageTitle($OSCOM_Product->getTitle()); $application->setPageContent('reviews_write.php'); $OSCOM_Template->addJavascriptPhpFilename(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/reviews_new.php'); if ($OSCOM_Service->isStarted('Breadcrumb')) { $OSCOM_Breadcrumb->add($OSCOM_Product->getTitle(), OSCOM::getLink(null, null, 'Reviews&' . $OSCOM_Product->getKeyword())); $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_reviews_new'), OSCOM::getLink(null, null, 'Reviews&Write&' . $OSCOM_Product->getKeyword())); } }
<?php /** * osCommerce Online Merchant * * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com * @license BSD License; http://www.oscommerce.com/bsdlicense.txt */ use osCommerce\OM\Core\DateTime; use osCommerce\OM\Core\HTML; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\PDO; use osCommerce\OM\Core\Site\Shop\Reviews; $reviews_listing = Reviews::getListing(); ?> <h1><?php echo $OSCOM_Template->getPageTitle(); ?> </h1> <?php foreach ($reviews_listing['entries'] as $r) { ?> <div class="moduleBox"> <div style="float: right; margin-top: 5px;"><?php echo sprintf(OSCOM::getDef('review_date_added'), DateTime::getLong($r['date_added'])); ?> </div>
<?php } ?> <div> <?php echo $OSCOM_Product->getDescription(); ?> </div> <?php if ($OSCOM_Service->isStarted('Reviews') && Reviews::exists(osc_get_product_id($OSCOM_Product->getID()), true)) { ?> <p><?php echo OSCOM::getDef('number_of_product_reviews') . ' ' . Reviews::getTotal(osc_get_product_id($OSCOM_Product->getID())); ?> </p> <?php } if ($OSCOM_Product->hasURL()) { ?> <p><?php echo sprintf(OSCOM::getDef('go_to_external_products_webpage'), OSCOM::getLink(null, 'Redirect', 'action=url&goto=' . urlencode($OSCOM_Product->getURL()), 'NONSSL', null, false)); ?> </p> <?php }
<?php } ?> <div> <?php echo $OSCOM_Product->getDescription(); ?> </div> <?php if ($OSCOM_Service->isStarted('Reviews') && Reviews::exists(Products::getProductID($OSCOM_Product->getID()), true)) { ?> <p><?php echo OSCOM::getDef('number_of_product_reviews') . ' ' . Reviews::getTotal(Products::getProductID($OSCOM_Product->getID())); ?> </p> <?php } if ($OSCOM_Product->hasURL()) { ?> <p><?php echo sprintf(OSCOM::getDef('go_to_external_products_webpage'), OSCOM::getLink(null, 'Redirect', 'action=url&goto=' . urlencode($OSCOM_Product->getURL()), 'NONSSL', null, false)); ?> </p> <?php }