Merge branch 'master' of https://github.com/bagisto/bagisto
This commit is contained in:
commit
e1cdff607b
|
|
@ -738,8 +738,11 @@ class Cart {
|
|||
foreach ($taxRates as $rate) {
|
||||
$haveTaxRate = false;
|
||||
|
||||
if ($rate->state != '' && $rate->state != $address->state)
|
||||
if ($rate->state != '' && $rate->state != $address->state) {
|
||||
$this->setItemTaxToZero($item);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $rate->is_zip) {
|
||||
if ($rate->zip_code == '*' || $rate->zip_code == $address->postcode)
|
||||
|
|
@ -757,24 +760,30 @@ class Cart {
|
|||
$item->save();
|
||||
break;
|
||||
} else {
|
||||
$item->tax_percent = 0;
|
||||
$item->tax_amount = 0;
|
||||
$item->base_tax_amount = 0;
|
||||
$this->setItemTaxToZero($item);
|
||||
|
||||
$item->save();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$item->tax_percent = 0;
|
||||
$item->tax_amount = 0;
|
||||
$item->base_tax_amount = 0;
|
||||
|
||||
$item->save();
|
||||
$this->setItemTaxToZero($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Item tax to zero.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setItemTaxToZero($item) {
|
||||
$item->tax_percent = 0;
|
||||
$item->tax_amount = 0;
|
||||
$item->base_tax_amount = 0;
|
||||
|
||||
$item->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if cart has any error
|
||||
*
|
||||
|
|
|
|||
|
|
@ -35,8 +35,9 @@ class ProductFlatRepository extends Repository
|
|||
}
|
||||
|
||||
/**
|
||||
* get Category Product
|
||||
* get Category Product Attribute
|
||||
*
|
||||
* @param CategoryId $categoryId
|
||||
* @return array
|
||||
*/
|
||||
public function getCategoryProductAttribute($categoryId)
|
||||
|
|
@ -61,4 +62,35 @@ class ProductFlatRepository extends Repository
|
|||
|
||||
return $productCategoryArrributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Filterable Attributes.
|
||||
*
|
||||
* @param array $category
|
||||
* @param array $products
|
||||
* @return collection
|
||||
*/
|
||||
public function getFilterableAttributes($category, $products) {
|
||||
$filterAttributes = [];
|
||||
|
||||
if (count($category->filterableAttributes) > 0 && count($products)) {
|
||||
$filterAttributes = $category->filterableAttributes;
|
||||
} else {
|
||||
$categoryProductAttributes = $this->getCategoryProductAttribute($category->id);
|
||||
|
||||
if ($categoryProductAttributes) {
|
||||
foreach (app('Webkul\Attribute\Repositories\AttributeRepository')->getFilterAttributes() as $filterAttribute) {
|
||||
if (in_array($filterAttribute->id, $categoryProductAttributes)) {
|
||||
$filterAttributes[] = $filterAttribute;
|
||||
} else if ($filterAttribute ['code'] == 'price') {
|
||||
$filterAttributes[] = $filterAttribute;
|
||||
}
|
||||
}
|
||||
|
||||
$filterAttributes = collect($filterAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
return $filterAttributes;
|
||||
}
|
||||
}
|
||||
|
|
@ -404,10 +404,12 @@
|
|||
|
||||
newBillingAddress: function() {
|
||||
this.new_billing_address = true;
|
||||
this.address.billing.address_id = null;
|
||||
},
|
||||
|
||||
newShippingAddress: function() {
|
||||
this.new_shipping_address = true;
|
||||
this.address.shipping.address_id = null;
|
||||
},
|
||||
|
||||
backToSavedBillingAddress: function() {
|
||||
|
|
|
|||
|
|
@ -10,23 +10,7 @@
|
|||
if (isset($category)) {
|
||||
$products = $productRepository->getAll($category->id);
|
||||
|
||||
if (count($category->filterableAttributes) > 0 && count($products)) {
|
||||
$filterAttributes = $category->filterableAttributes;
|
||||
} else {
|
||||
$categoryProductAttributes = $productFlatRepository->getCategoryProductAttribute($category->id);
|
||||
|
||||
if ($categoryProductAttributes) {
|
||||
foreach ($attributeRepository->getFilterAttributes() as $filterAttribute) {
|
||||
if (in_array($filterAttribute->id, $categoryProductAttributes)) {
|
||||
$filterAttributes[] = $filterAttribute;
|
||||
} else if ($filterAttribute ['code'] == 'price') {
|
||||
$filterAttributes[] = $filterAttribute;
|
||||
}
|
||||
}
|
||||
|
||||
$filterAttributes = collect($filterAttributes);
|
||||
}
|
||||
}
|
||||
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
|
||||
} else {
|
||||
$filterAttributes = $attributeRepository->getFilterAttributes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@
|
|||
newBillingAddress: function() {
|
||||
this.new_billing_address = true;
|
||||
this.isPlaceOrderEnabled = false;
|
||||
this.address.shipping.address_id = null;
|
||||
this.address.billing.address_id = null;
|
||||
},
|
||||
|
||||
newShippingAddress: function() {
|
||||
|
|
|
|||
|
|
@ -8,26 +8,22 @@
|
|||
if (isset($category)) {
|
||||
$products = $productRepository->getAll($category->id);
|
||||
|
||||
if (count($category->filterableAttributes) > 0 && count($products)) {
|
||||
$filterAttributes = $category->filterableAttributes;
|
||||
} else {
|
||||
$categoryProductAttributes = $productFlatRepository->getCategoryProductAttribute($category->id);
|
||||
|
||||
if ($categoryProductAttributes) {
|
||||
foreach ($attributeRepository->getFilterAttributes() as $filterAttribute) {
|
||||
if (in_array($filterAttribute->id, $categoryProductAttributes)) {
|
||||
$filterAttributes[] = $filterAttribute;
|
||||
} else if ($filterAttribute ['code'] == 'price') {
|
||||
$filterAttributes[] = $filterAttribute;
|
||||
}
|
||||
}
|
||||
|
||||
$filterAttributes = collect($filterAttributes);
|
||||
}
|
||||
}
|
||||
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
|
||||
} else {
|
||||
$filterAttributes = $attributeRepository->getFilterAttributes();
|
||||
}
|
||||
|
||||
foreach ($filterAttributes as $attribute) {
|
||||
if ($attribute->code <> 'price') {
|
||||
if (! $attribute->options->isEmpty()) {
|
||||
$attributes[] = $attribute;
|
||||
}
|
||||
} else {
|
||||
$attributes[] = $attribute;
|
||||
}
|
||||
}
|
||||
|
||||
$filterAttributes = collect($attributes);
|
||||
?>
|
||||
|
||||
<div class="layered-filter-wrapper left">
|
||||
|
|
|
|||
Loading…
Reference in New Issue