-
-
Notifications
You must be signed in to change notification settings - Fork 549
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
1 parent
6857a9b
commit a88ebea
Showing
13 changed files
with
278 additions
and
144 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
APP_ENV=local | ||
APP_ENV=production | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_LOG_LEVEL=debug | ||
|
312 changes: 184 additions & 128 deletions
312
modules/base/Mage2/Cart/views/cart/cart/view.blade.php
Large diffs are not rendered by default.
Oops, something went wrong.
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
81 changes: 81 additions & 0 deletions
81
modules/base/Mage2/Sale/Controllers/GiftCouponController.php
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,81 @@ | ||
<?php | ||
/** | ||
* Mage2 | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the GNU General Public License v3.0 | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://mage2.website for more information. | ||
* | ||
* @author Purvesh <[email protected]> | ||
* @copyright 2016-2017 Mage2 | ||
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License v3.0 | ||
*/ | ||
|
||
namespace Mage2\Sale\Controllers; | ||
|
||
use Carbon\Carbon; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Response; | ||
use Illuminate\Support\Facades\Session; | ||
use Mage2\Catalog\Models\Product; | ||
use Mage2\Framework\System\Controllers\Controller; | ||
use Mage2\Sale\Models\GiftCoupon; | ||
|
||
class GiftCouponController extends Controller { | ||
|
||
public function getCodeDiscount(Request $request) { | ||
|
||
$code = $request->get('code'); | ||
|
||
if(true == empty($code)) { | ||
return Response::json(['success' => false,'message' => "Code Can't be Empty"]); | ||
} | ||
|
||
|
||
$todayCarbonDate = Carbon::now(); | ||
$giftCoupon = GiftCoupon::whereCode($code)->whereStatus('ENABLED')->where('end_date','>',$todayCarbonDate )->first(); | ||
if(null === $giftCoupon ) { | ||
return Response::json(['success' => false,'message' => "Invalid Coupon"]); | ||
} | ||
|
||
$cartItems = Session::get('cart'); | ||
|
||
foreach($cartItems as $id => $item) { | ||
|
||
$product = Product::findorfail($id); | ||
|
||
if(isset($item['gift_coupon_amount'])) { | ||
$price = $product->price; | ||
} else { | ||
$price = $item['price']; | ||
} | ||
|
||
|
||
|
||
$couponDiscount = ($price * $giftCoupon->discount / 100); | ||
$item['price'] = $price - $couponDiscount; | ||
$item['gift_coupon_code'] = $giftCoupon->code; | ||
$item['gift_coupon_amount'] = $couponDiscount; | ||
$item['tax_amount'] = $product->getTaxAmount($item['price']); | ||
|
||
$cartItems[$id] = $item; | ||
} | ||
|
||
Session::put('cart', $cartItems); | ||
return Response::json(['success' => true]); | ||
|
||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
modules/base/Mage2/Sale/views/admin/gift-coupon/_fields.blade.php
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