-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved directory structure to make it compatible for Packagist repository
- Loading branch information
Showing
76 changed files
with
3,428 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace OrviSoft\CouponPerProduct\Api; | ||
|
||
interface DiscountpercouponManagementInterface | ||
{ | ||
|
||
/** | ||
* GET for Discountpercoupon api | ||
* @param string $param | ||
* @return string | ||
*/ | ||
public function getDiscountpercoupon($param); | ||
} |
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,87 @@ | ||
<?php | ||
|
||
namespace OrviSoft\CouponPerProduct\Block\Adminhtml; | ||
|
||
class Coupons extends \Magento\Backend\Block\Widget\Container | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_template = 'coupons/coupons.phtml'; | ||
|
||
/** | ||
* @param \Magento\Backend\Block\Widget\Context $context | ||
* @param array $data | ||
*/ | ||
public function __construct(\Magento\Backend\Block\Widget\Context $context,array $data = []) | ||
{ | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Prepare button and grid | ||
* | ||
* @return \Magento\Catalog\Block\Adminhtml\Product | ||
*/ | ||
protected function _prepareLayout() | ||
{ | ||
|
||
|
||
$addButtonProps = [ | ||
'id' => 'add_new', | ||
'label' => __('Add New'), | ||
'class' => 'add', | ||
'button_class' => '', | ||
'class_name' => 'Magento\Backend\Block\Widget\Button\SplitButton', | ||
'options' => $this->_getAddButtonOptions(), | ||
]; | ||
$this->buttonList->add('add_new', $addButtonProps); | ||
|
||
|
||
$this->setChild( | ||
'grid', | ||
$this->getLayout()->createBlock('OrviSoft\CouponPerProduct\Block\Adminhtml\Coupons\Grid', 'orvisoft.coupons.grid') | ||
); | ||
return parent::_prepareLayout(); | ||
} | ||
|
||
/** | ||
* | ||
* | ||
* @return array | ||
*/ | ||
protected function _getAddButtonOptions() | ||
{ | ||
|
||
$splitButtonOptions[] = [ | ||
'label' => __('Add New'), | ||
'onclick' => "setLocation('" . $this->_getCreateUrl() . "')" | ||
]; | ||
|
||
return $splitButtonOptions; | ||
} | ||
|
||
/** | ||
* | ||
* | ||
* @param string $type | ||
* @return string | ||
*/ | ||
protected function _getCreateUrl() | ||
{ | ||
return $this->getUrl( | ||
'couponperproduct/*/new' | ||
); | ||
} | ||
|
||
/** | ||
* Render grid | ||
* | ||
* @return string | ||
*/ | ||
public function getGridHtml() | ||
{ | ||
return $this->getChildHtml('grid'); | ||
} | ||
|
||
} |
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,103 @@ | ||
<?php | ||
|
||
namespace OrviSoft\CouponPerProduct\Block\Adminhtml\Coupons; | ||
|
||
class Edit extends \Magento\Backend\Block\Widget\Form\Container | ||
{ | ||
/** | ||
* Core registry | ||
* | ||
* @var \Magento\Framework\Registry | ||
*/ | ||
protected $_coreRegistry = null; | ||
|
||
/** | ||
* @param \Magento\Backend\Block\Widget\Context $context | ||
* @param \Magento\Framework\Registry $registry | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Widget\Context $context, | ||
\Magento\Framework\Registry $registry, | ||
array $data = [] | ||
) { | ||
$this->_coreRegistry = $registry; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Initialize coupons edit block | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_objectId = 'id'; | ||
$this->_blockGroup = 'OrviSoft_CouponPerProduct'; | ||
$this->_controller = 'adminhtml_coupons'; | ||
|
||
parent::_construct(); | ||
|
||
$this->buttonList->update('save', 'label', __('Save Coupons')); | ||
$this->buttonList->add( | ||
'saveandcontinue', | ||
[ | ||
'label' => __('Save and Continue Edit'), | ||
'class' => 'save', | ||
'data_attribute' => [ | ||
'mage-init' => [ | ||
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'], | ||
], | ||
] | ||
], | ||
-100 | ||
); | ||
|
||
$this->buttonList->update('delete', 'label', __('Delete Coupons')); | ||
} | ||
|
||
/** | ||
* Retrieve text for header element depending on loaded post | ||
* | ||
* @return \Magento\Framework\Phrase | ||
*/ | ||
public function getHeaderText() | ||
{ | ||
if ($this->_coreRegistry->registry('coupons')->getId()) { | ||
return __("Edit Coupons '%1'", $this->escapeHtml($this->_coreRegistry->registry('coupons')->getTitle())); | ||
} else { | ||
return __('New Coupons'); | ||
} | ||
} | ||
|
||
/** | ||
* Getter of url for "Save and Continue" button | ||
* tab_id will be replaced by desired by JS later | ||
* | ||
* @return string | ||
*/ | ||
protected function _getSaveAndContinueUrl() | ||
{ | ||
return $this->getUrl('couponperproduct/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']); | ||
} | ||
|
||
/** | ||
* Prepare layout | ||
* | ||
* @return \Magento\Framework\View\Element\AbstractBlock | ||
*/ | ||
protected function _prepareLayout() | ||
{ | ||
$this->_formScripts[] = " | ||
function toggleEditor() { | ||
if (tinyMCE.getInstanceById('page_content') == null) { | ||
tinyMCE.execCommand('mceAddControl', false, 'content'); | ||
} else { | ||
tinyMCE.execCommand('mceRemoveControl', false, 'content'); | ||
} | ||
}; | ||
"; | ||
return parent::_prepareLayout(); | ||
} | ||
|
||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace OrviSoft\CouponPerProduct\Block\Adminhtml\Coupons\Edit; | ||
|
||
/** | ||
* Adminhtml coupons edit form block | ||
* | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Form extends \Magento\Backend\Block\Widget\Form\Generic | ||
{ | ||
/** | ||
* Prepare form | ||
* | ||
* @return $this | ||
*/ | ||
protected function _prepareForm() | ||
{ | ||
/** @var \Magento\Framework\Data\Form $form */ | ||
$form = $this->_formFactory->create( | ||
['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post' , 'enctype' => 'multipart/form-data']] | ||
); | ||
$form->setUseContainer(true); | ||
$this->setForm($form); | ||
return parent::_prepareForm(); | ||
} | ||
} |
Oops, something went wrong.