This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
9,930 additions
and
1,800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -562,49 +562,6 @@ public function getReturnUrl() | |
return Yii::app()->session['returnUrl']; | ||
} | ||
|
||
/** | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gabeguz
|
||
* Cycle through Product model for page and mark beginning and end of each row. | ||
* | ||
* Used for <div row> formatting in the view layer. | ||
* | ||
* @param $model | ||
* @return mixed | ||
*/ | ||
protected function createBookends($model) | ||
{ | ||
if (count($model) == 0 || Yii::app()->theme->config->disableGridRowDivs) | ||
{ | ||
return $model; | ||
} | ||
|
||
$ct = -1; | ||
$next = 0; | ||
foreach ($model as $item) | ||
{ | ||
$ct++; | ||
if ($ct == 0) | ||
{ | ||
$model[$ct]->rowBookendFront = true; | ||
} | ||
|
||
if ($next == 1) | ||
{ | ||
$model[$ct]->rowBookendFront = true; | ||
$next = 0; | ||
} | ||
|
||
if ((1 + $ct) % $this->gridProductsPerRow == 0) | ||
{ | ||
$model[$ct]->rowBookendBack = true; | ||
$next = 1; | ||
} | ||
} | ||
|
||
$model[count($model) - 1]->rowBookendBack = true; //Last item must always close div | ||
return $model; | ||
} | ||
|
||
|
||
protected function afterRender($view, &$output) { | ||
parent::afterRender($view, $output); | ||
//Yii::app()->facebook->addJsCallback($js); // use this if you are registering any $js code you want to run asyc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?php | ||
|
||
/** | ||
* Class ProductGrid | ||
* This class generates the array needed to display web store products in a | ||
* grid. This class also contains the pagination information for customers to | ||
* navigated products displayed. The product grid is based on certain criteria | ||
* applied against the xlsws_product table. | ||
*/ | ||
class ProductGrid | ||
{ | ||
/** | ||
* This holds the criteria that the grid needs | ||
* to display itself. This criteria runs against | ||
* the product model and the pagination object. | ||
* | ||
* @var CDbCriteria | ||
*/ | ||
private $_productGridCriteria; | ||
|
||
/** | ||
* This variable holds the pagination information | ||
* for the grid. The criteria is passed to it to know | ||
* how many pages are needed to display all the products. | ||
* | ||
* @var CPagination | ||
*/ | ||
private $_pages; | ||
|
||
/** | ||
* This contains a subset of the products. Only the products | ||
* in the current page will be in that array. | ||
* | ||
* @var Product[] | ||
*/ | ||
private $_productsGrid; | ||
|
||
/** | ||
* Holds the number of products that the entire grid holds. | ||
* This is a count of all the products based on the criteria. | ||
* | ||
* @var int | ||
*/ | ||
private $_numberOfRecords; | ||
|
||
/** | ||
* Based on a criteria, this will generate the products | ||
* grid to be displayed on the page. | ||
* @param CDbCriteria $criteria A criteria object that determines | ||
* which products to get from the DB. | ||
*/ | ||
public function __construct($criteria) | ||
{ | ||
if ($criteria instanceof CDbCriteria === false) | ||
{ | ||
$criteria = new CDbCriteria(); | ||
} | ||
|
||
$this->_productGridCriteria = $criteria; | ||
$this->generateProductGrid(); | ||
} | ||
|
||
/** | ||
* This function generates the products grid | ||
* based on the criteria. It also generates the | ||
* pagination object need for the users to navigate | ||
* through products. | ||
* | ||
* @return void | ||
*/ | ||
public function generateProductGrid() | ||
{ | ||
$this->_numberOfRecords = Product::model()->count( | ||
$this->_productGridCriteria | ||
); | ||
|
||
$this->_pages = new CPagination($this->_numberOfRecords); | ||
$this->_pages->setPageSize( | ||
CPropertyValue::ensureInteger(Yii::app()->params['PRODUCTS_PER_PAGE']) | ||
); | ||
$this->_pages->applyLimit($this->_productGridCriteria); | ||
|
||
$this->_productsGrid = self::createBookends( | ||
Product::model()->findAll($this->_productGridCriteria) | ||
); | ||
} | ||
|
||
/** | ||
* This function returns a CPagination object needed to display | ||
* pagination for the products grid | ||
* | ||
* @return CPagination | ||
*/ | ||
public function getPages() | ||
{ | ||
return $this->_pages; | ||
} | ||
|
||
/** | ||
* This function returns an object containing the product | ||
* grid. | ||
* | ||
* @return mixed | ||
*/ | ||
public function getProductGrid() | ||
{ | ||
return $this->_productsGrid; | ||
} | ||
|
||
/** | ||
* This function returns the number of products return by the query. | ||
* This count is based on the product grid criteria. | ||
* | ||
* @return int | ||
*/ | ||
public function getNumberOfRecords() | ||
{ | ||
return $this->_numberOfRecords; | ||
} | ||
|
||
/** | ||
* Cycle through Product model for page and mark beginning and end of each row. | ||
* | ||
* Used for <div row> formatting in the view layer. | ||
* | ||
* @param $model | ||
* @return mixed | ||
*/ | ||
public static function createBookends($objProducts) | ||
{ | ||
$gridProductsPerRow = _xls_get_conf('PRODUCTS_PER_ROW', 3); | ||
if (count($objProducts) == 0 || Yii::app()->theme->config->disableGridRowDivs) | ||
{ | ||
return $objProducts; | ||
} | ||
|
||
foreach ($objProducts as $idx => $item) | ||
{ | ||
switch ($idx % $gridProductsPerRow) | ||
{ | ||
case 0: | ||
$objProducts[$idx]->rowBookendFront = true; | ||
break; | ||
case $gridProductsPerRow - 1: | ||
$objProducts[$idx]->rowBookendBack = true; | ||
break; | ||
} | ||
} | ||
|
||
end($objProducts)->rowBookendBack = true; //Last item must always close div | ||
return $objProducts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
|
||
define('XLSWS_VERSION', '3.2.8'); | ||
define('XLSWS_VERSIONBUILD', 300200800); | ||
define('XLSWS_BUILDDATE', 'webstore-2015-05-15-1249'); | ||
define('XLSWS_VERSION', '3.2.9'); | ||
define('XLSWS_VERSIONBUILD', 300200900); | ||
define('XLSWS_BUILDDATE', 'webstore-2015-06-16-2039'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Hello, I was wondering why this method has been removed instead of deprecated?