Skip to content

Commit

Permalink
Merge pull request #223 from oc-shopaholic/develop
Browse files Browse the repository at this point in the history
Release version 1.23.0
  • Loading branch information
kharanenka authored Oct 18, 2019
2 parents 18a8415 + 0627eba commit fa6c4f8
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 50 deletions.
3 changes: 3 additions & 0 deletions classes/collection/OfferCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* @method $this filterByDiscount()
* @method $this filterByQuantity()
* @method $this filterByProperty(array $arFilterList, \Lovata\FilterShopaholic\Classes\Collection\FilterPropertyCollection $obPropertyList)
*
* Digital products for Shopaholic
* @method $this sortByPeriod()
*/
class OfferCollection extends ElementCollection
{
Expand Down
8 changes: 6 additions & 2 deletions classes/console/CheckTableIntegrity.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ public function handle()
{
foreach ($this->arMigrationList as $arMigrationData) {
$sClassName = $arMigrationData['class'];
$sFilePath = $arMigrationData['path'];
include_once base_path($sFilePath);
$sFilePath = base_path($arMigrationData['path']);
if (!file_exists($sFilePath)) {
continue;
}

include_once $sFilePath;

if (!class_exists($sClassName)) {
continue;
Expand Down
24 changes: 19 additions & 5 deletions classes/helper/PriceTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PriceTypeHelper
protected $sActivePriceTypeCode;

/**
* Get value of active currency
* Get value of active price type
* @param string $sPriceTypeCode
* @return PriceType
*/
Expand All @@ -35,7 +35,7 @@ public function findByCode($sPriceTypeCode)
}

/**
* Get value of active currency
* Get value of active price type
* @return PriceType
*/
public function getActive()
Expand All @@ -44,7 +44,7 @@ public function getActive()
}

/**
* Get active currency code
* Get active price type code
* @return null|string
*/
public function getActivePriceTypeCode()
Expand All @@ -57,6 +57,20 @@ public function getActivePriceTypeCode()
return $obPriceType->code;
}

/**
* Get active price type code
* @return null|string
*/
public function getActivePriceTypeID()
{
$obPriceType = $this->getActive();
if (empty($obPriceType)) {
return null;
}

return $obPriceType->id;
}

/**
* Clear active currency value
* @param string $sPriceTypeCode
Expand All @@ -69,7 +83,7 @@ public function switchActive($sPriceTypeCode)
}

/**
* Init currency data
* Init price type data
*/
protected function init()
{
Expand All @@ -79,7 +93,7 @@ protected function init()
}

/**
* Get active currency code and find active currency object by code
* Get active price type code and find active price type object by code
*/
protected function initActivePriceType()
{
Expand Down
4 changes: 2 additions & 2 deletions classes/import/ImportCategoryModelFromXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ protected function processModelObject()
$this->importPreviewImage();
$this->importImageList();

$this->importChildrenCategoryList();

parent::processModelObject();

$this->importChildrenCategoryList();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions classes/item/CategoryItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
* Filter for Shopaholic
* @property \Lovata\FilterShopaholic\Classes\Collection\FilterPropertyCollection|\Lovata\PropertiesShopaholic\Classes\Item\PropertyItem[] $product_filter_property
* @property \Lovata\FilterShopaholic\Classes\Collection\FilterPropertyCollection|\Lovata\PropertiesShopaholic\Classes\Item\PropertyItem[] $offer_filter_property
*
* VKontakte for Shopaholic
* @property int $category_vk_id
*/
class CategoryItem extends ElementItem
{
Expand Down
31 changes: 27 additions & 4 deletions classes/item/OfferItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Lovata\Shopaholic\Models\Offer;
use Lovata\Shopaholic\Classes\Helper\TaxHelper;
use Lovata\Shopaholic\Classes\Helper\CurrencyHelper;
use Lovata\Shopaholic\Classes\Helper\PriceTypeHelper;

/**
* Class OfferItem
Expand Down Expand Up @@ -72,6 +73,22 @@
* @property int $discount_id
* @property float $discount_value
* @property string $discount_type
*
* Digital products for Shopaholic
* @property int $digital_product_period_id
* @property \Lovata\DigitalProductsShopaholic\Classes\Item\DigitalProductPeriodItem $digital_product_period
*
* YandexMarket for Shopaholic
* @property \System\Models\File $preview_image_yandex
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_yandex
*
* Facebook for Shopaholic
* @property \System\Models\File $preview_image_facebook
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_facebook
*
* VKontakte for Shopaholic
* @property \System\Models\File $preview_image_vkontakte
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_vkontakte
*/
class OfferItem extends ElementItem
{
Expand Down Expand Up @@ -146,6 +163,10 @@ public function setActiveCurrency($sActiveCurrencyCode)
*/
public function getActivePriceType()
{
if (empty($this->iActivePriceType)) {
$this->iActivePriceType = PriceTypeHelper::instance()->getActivePriceTypeID();
}

return $this->iActivePriceType;
}

Expand Down Expand Up @@ -176,10 +197,11 @@ protected function setElementObject()
*/
protected function getPriceValueAttribute()
{
if (empty($this->iActivePriceType)) {
$iActivePriceType = $this->getActivePriceType();
if (empty($iActivePriceType)) {
$fPrice = $this->getAttribute('price_value');
} else {
$fPrice = array_get($this->price_list, $this->iActivePriceType.'.price');
$fPrice = array_get($this->price_list, $iActivePriceType.'.price');
}

$fPrice = CurrencyHelper::instance()->convert($fPrice, $this->getActiveCurrency());
Expand All @@ -193,10 +215,11 @@ protected function getPriceValueAttribute()
*/
protected function getOldPriceValueAttribute()
{
if (empty($this->iActivePriceType)) {
$iActivePriceType = $this->getActivePriceType();
if (empty($iActivePriceType)) {
$fPrice = $this->getAttribute('old_price_value');
} else {
$fPrice = array_get($this->price_list, $this->iActivePriceType.'.old_price');
$fPrice = array_get($this->price_list, $iActivePriceType.'.old_price');
}

$fPrice = CurrencyHelper::instance()->convert($fPrice, $this->getActiveCurrency());
Expand Down
14 changes: 14 additions & 0 deletions classes/item/ProductItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@
*
* Wish list for Shopaholic
* @method bool inWishList()
*
* YandexMarket for Shopaholic
* @property \System\Models\File $preview_image_yandex
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_yandex
*
* Facebook for Shopaholic
* @property \System\Models\File $preview_image_facebook
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_facebook
*
* VKontakte for Shopaholic
* @property bool $active_vk
* @property int $external_vk_id
* @property \System\Models\File $preview_image_vkontakte
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_vkontakte
*/
class ProductItem extends ElementItem
{
Expand Down
3 changes: 3 additions & 0 deletions models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
* Campaign for Shopaholic
* @property \October\Rain\Database\Collection|\Lovata\CampaignsShopaholic\Models\Campaign[] $campaign
* @method static \October\Rain\Database\Relations\BelongsToMany|\Lovata\CampaignsShopaholic\Models\Campaign campaign()
*
* VKontakte for Shopaholic
* @property int $category_vk_id
*/
class Category extends ImportModel
{
Expand Down
19 changes: 18 additions & 1 deletion models/Offer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@
* Campaign for Shopaholic
* @property \October\Rain\Database\Collection|\Lovata\CampaignsShopaholic\Models\Campaign[] $campaign
* @method static \October\Rain\Database\Relations\BelongsToMany|\Lovata\CampaignsShopaholic\Models\Campaign campaign()
*
* Digital product for Shopaholic
* @property int $digital_product_period_id
* @property \Lovata\DigitalProductsShopaholic\Models\DigitalProductPeriod $digital_product_period
* @method static \October\Rain\Database\Relations\BelongsTo|\Lovata\DigitalProductsShopaholic\Models\DigitalProductPeriod digital_product_period()
*
* YandexMarket for Shopaholic
* @property \System\Models\File $preview_image_yandex
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_yandex
*
* Facebook for Shopaholic
* @property \System\Models\File $preview_image_facebook
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_facebook
*
* VKontakte for Shopaholic
* @property \System\Models\File $preview_image_vkontakte
* @property \October\Rain\Database\Collection|\System\Models\File[] $images_vkontakte
*/
class Offer extends ImportModel
{
Expand Down Expand Up @@ -242,7 +259,7 @@ public function afterSave()

/**
* Set quantity attribute value
* @param int $iQuantity
* @param int $iQuantity
*/
public function setQuantityAttribute($iQuantity)
{
Expand Down
Loading

0 comments on commit fa6c4f8

Please sign in to comment.