How to display list of coupon code in product page in magento 2.2.7 The Next CEO of Stack OverflowGet RuleId from Coupon Code in checkoutcartitemdefault.phtmlGet a coupon code to send in welcome emailGenerate Coupon code based on categorycoupon code error message for guest customersmagento coupon code is behaving strangely?Apply Magento Coupon in Ajax Without Redirecting to Cart PageProgramatically generated coupon code not displaying on shopping cart after appliedDisplay Auto-generated Coupon code on success pagegenerating lowercase Coupon codehow to show Promo code or coupon code on Checkout page in magento 1.9How to display MSRP price at product listing page and view page in magento 2.2.7?
Compilation of a 2d array and a 1d array
What difference does it make matching a word with/without a trailing whitespace?
Finitely generated matrix groups whose eigenvalues are all algebraic
Man transported from Alternate World into ours by a Neutrino Detector
Raspberry pi 3 B with Ubuntu 18.04 server arm64: what pi version
A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?
Calculate the Mean mean of two numbers
Is a linearly independent set whose span is dense a Schauder basis?
Can Sri Krishna be called 'a person'?
Can this transistor (2n2222) take 6V on emitter-base? Am I reading datasheet incorrectly?
How should I connect my cat5 cable to connectors having an orange-green line?
Is it okay to majorly distort historical facts while writing a fiction story?
Is it possible to create a QR code using text?
Does int main() need a declaration on C++?
Does the Idaho Potato Commission associate potato skins with healthy eating?
The sum of any ten consecutive numbers from a fibonacci sequence is divisible by 11
Avoiding the "not like other girls" trope?
Is it OK to decorate a log book cover?
How to unfasten electrical subpanel attached with ramset
Another proof that dividing by 0 does not exist -- is it right?
Mathematica command that allows it to read my intentions
Airship steam engine room - problems and conflict
Masking layers by a vector polygon layer in QGIS
Calculating discount not working
How to display list of coupon code in product page in magento 2.2.7
The Next CEO of Stack OverflowGet RuleId from Coupon Code in checkoutcartitemdefault.phtmlGet a coupon code to send in welcome emailGenerate Coupon code based on categorycoupon code error message for guest customersmagento coupon code is behaving strangely?Apply Magento Coupon in Ajax Without Redirecting to Cart PageProgramatically generated coupon code not displaying on shopping cart after appliedDisplay Auto-generated Coupon code on success pagegenerating lowercase Coupon codehow to show Promo code or coupon code on Checkout page in magento 1.9How to display MSRP price at product listing page and view page in magento 2.2.7?
How to display list of coupon code in product page.
coupon-codes magento2.2.7
add a comment |
How to display list of coupon code in product page.
coupon-codes magento2.2.7
Try this answer @satish
– Prathap Gunasekaran
13 hours ago
add a comment |
How to display list of coupon code in product page.
coupon-codes magento2.2.7
How to display list of coupon code in product page.
coupon-codes magento2.2.7
coupon-codes magento2.2.7
asked 14 hours ago
satishsatish
16212
16212
Try this answer @satish
– Prathap Gunasekaran
13 hours ago
add a comment |
Try this answer @satish
– Prathap Gunasekaran
13 hours ago
Try this answer @satish
– Prathap Gunasekaran
13 hours ago
Try this answer @satish
– Prathap Gunasekaran
13 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Try this,
Add a helper on your custom module and path be like
app/code/Vendor/Module/Helper/Data.php
then add the below code to get the coupon code collection
<?php
namespace VendorModuleNameHelper;
class Data extends MagentoFrameworkAppHelperAbstractHelper
public function __construct(
MagentoSalesRuleModelCouponFactory $couponFactory
)
$this->couponFactory = $couponFactory;
public function getCoupon()
$couponCollection = $this->couponFactory->create()->getCollection();
return $couponCollection;
then add catalog_product_view.xml in your custom module and path be like
app/code/Vendor/Module/view/frontend/layout/catalog_product_view.xml
then add the below code to it
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="product_coupon" template="Vendor_Module::coupon.phtml">
</block>
</referenceContainer>
</body>
</page>
then add the phtml in the below path
app/code/Vendor/Module/view/frontend/templates/coupon.phtml
then add the below code to the phtml file to get the coupon collection
<?php $coupon = $this->helper('VendorModuleHelperData')->getCoupon();
foreach($coupon as $items)
echo "Coupon Code :" . $items->getCode();
You'll get all the coupon code there and you can get any other attribute from this table salesrule_coupon
For more information refer this link
Hope this helps.
add a comment |
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268198%2fhow-to-display-list-of-coupon-code-in-product-page-in-magento-2-2-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this,
Add a helper on your custom module and path be like
app/code/Vendor/Module/Helper/Data.php
then add the below code to get the coupon code collection
<?php
namespace VendorModuleNameHelper;
class Data extends MagentoFrameworkAppHelperAbstractHelper
public function __construct(
MagentoSalesRuleModelCouponFactory $couponFactory
)
$this->couponFactory = $couponFactory;
public function getCoupon()
$couponCollection = $this->couponFactory->create()->getCollection();
return $couponCollection;
then add catalog_product_view.xml in your custom module and path be like
app/code/Vendor/Module/view/frontend/layout/catalog_product_view.xml
then add the below code to it
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="product_coupon" template="Vendor_Module::coupon.phtml">
</block>
</referenceContainer>
</body>
</page>
then add the phtml in the below path
app/code/Vendor/Module/view/frontend/templates/coupon.phtml
then add the below code to the phtml file to get the coupon collection
<?php $coupon = $this->helper('VendorModuleHelperData')->getCoupon();
foreach($coupon as $items)
echo "Coupon Code :" . $items->getCode();
You'll get all the coupon code there and you can get any other attribute from this table salesrule_coupon
For more information refer this link
Hope this helps.
add a comment |
Try this,
Add a helper on your custom module and path be like
app/code/Vendor/Module/Helper/Data.php
then add the below code to get the coupon code collection
<?php
namespace VendorModuleNameHelper;
class Data extends MagentoFrameworkAppHelperAbstractHelper
public function __construct(
MagentoSalesRuleModelCouponFactory $couponFactory
)
$this->couponFactory = $couponFactory;
public function getCoupon()
$couponCollection = $this->couponFactory->create()->getCollection();
return $couponCollection;
then add catalog_product_view.xml in your custom module and path be like
app/code/Vendor/Module/view/frontend/layout/catalog_product_view.xml
then add the below code to it
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="product_coupon" template="Vendor_Module::coupon.phtml">
</block>
</referenceContainer>
</body>
</page>
then add the phtml in the below path
app/code/Vendor/Module/view/frontend/templates/coupon.phtml
then add the below code to the phtml file to get the coupon collection
<?php $coupon = $this->helper('VendorModuleHelperData')->getCoupon();
foreach($coupon as $items)
echo "Coupon Code :" . $items->getCode();
You'll get all the coupon code there and you can get any other attribute from this table salesrule_coupon
For more information refer this link
Hope this helps.
add a comment |
Try this,
Add a helper on your custom module and path be like
app/code/Vendor/Module/Helper/Data.php
then add the below code to get the coupon code collection
<?php
namespace VendorModuleNameHelper;
class Data extends MagentoFrameworkAppHelperAbstractHelper
public function __construct(
MagentoSalesRuleModelCouponFactory $couponFactory
)
$this->couponFactory = $couponFactory;
public function getCoupon()
$couponCollection = $this->couponFactory->create()->getCollection();
return $couponCollection;
then add catalog_product_view.xml in your custom module and path be like
app/code/Vendor/Module/view/frontend/layout/catalog_product_view.xml
then add the below code to it
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="product_coupon" template="Vendor_Module::coupon.phtml">
</block>
</referenceContainer>
</body>
</page>
then add the phtml in the below path
app/code/Vendor/Module/view/frontend/templates/coupon.phtml
then add the below code to the phtml file to get the coupon collection
<?php $coupon = $this->helper('VendorModuleHelperData')->getCoupon();
foreach($coupon as $items)
echo "Coupon Code :" . $items->getCode();
You'll get all the coupon code there and you can get any other attribute from this table salesrule_coupon
For more information refer this link
Hope this helps.
Try this,
Add a helper on your custom module and path be like
app/code/Vendor/Module/Helper/Data.php
then add the below code to get the coupon code collection
<?php
namespace VendorModuleNameHelper;
class Data extends MagentoFrameworkAppHelperAbstractHelper
public function __construct(
MagentoSalesRuleModelCouponFactory $couponFactory
)
$this->couponFactory = $couponFactory;
public function getCoupon()
$couponCollection = $this->couponFactory->create()->getCollection();
return $couponCollection;
then add catalog_product_view.xml in your custom module and path be like
app/code/Vendor/Module/view/frontend/layout/catalog_product_view.xml
then add the below code to it
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoFrameworkViewElementTemplate" name="product_coupon" template="Vendor_Module::coupon.phtml">
</block>
</referenceContainer>
</body>
</page>
then add the phtml in the below path
app/code/Vendor/Module/view/frontend/templates/coupon.phtml
then add the below code to the phtml file to get the coupon collection
<?php $coupon = $this->helper('VendorModuleHelperData')->getCoupon();
foreach($coupon as $items)
echo "Coupon Code :" . $items->getCode();
You'll get all the coupon code there and you can get any other attribute from this table salesrule_coupon
For more information refer this link
Hope this helps.
answered 13 hours ago
Prathap GunasekaranPrathap Gunasekaran
1,5861618
1,5861618
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268198%2fhow-to-display-list-of-coupon-code-in-product-page-in-magento-2-2-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try this answer @satish
– Prathap Gunasekaran
13 hours ago