{"id":440,"date":"2010-10-07T22:28:47","date_gmt":"2010-10-08T06:28:47","guid":{"rendered":"https:\/\/www.numinix.com\/blog\/?p=440"},"modified":"2019-05-29T11:02:15","modified_gmt":"2019-05-29T18:02:15","slug":"how-to-make-an-inactive-coupon-active","status":"publish","type":"post","link":"https:\/\/www.numinix.com\/blog\/how-to-make-an-inactive-coupon-active\/","title":{"rendered":"How to Make an Inactive Coupon Active in Zen Cart"},"content":{"rendered":"<p><em>Note: This article discusses a known bug in Zen Cart that is present in all versions up to and including version 1.3.9g.\u00a0 Hopefully after reading this, the Zen Cart team will implement this simple fix.<\/em><\/p>\n<p>Today a client was trying to re-enable one of his old coupon codes that had expired by simply changing the start and finish dates.\u00a0 You&#8217;d be astonished to know this isn&#8217;t possible without deleting and recreating the coupon or by copying it and then using the copy.\u00a0 Basically, extra steps that a store owner shouldn&#8217;t have to do.<\/p>\n<p>So, I did a quick search of the Zen-Cart.com forum and found this thread from 2007 explaining the steps above.\u00a0 <a href=\"http:\/\/www.zen-cart.com\/forum\/showthread.php?p=386571#post386571\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/www.zen-cart.com\/forum\/showthread.php?p=386571#post386571<\/a>.\u00a0 Wow, this thread is from 2007 and the bug still hasn&#8217;t been fixed?\u00a0 So I looked into it and found it can be resolved with a single line of code. Took less time to fix than to perform the &#8220;recommended&#8221; rename\/copy workaround.<\/p>\n<p>Open admin\/coupon_admin.php and find:<\/p>\n<pre lang=\"php\" line=\"236\" escaped=\"true\">$sql_data_array = array('coupon_code' =&gt; zen_db_prepare_input($_POST['coupon_code']),\r\n 'coupon_amount' =&gt; zen_db_prepare_input($_POST['coupon_amount']),\r\n 'coupon_type' =&gt; zen_db_prepare_input($coupon_type),\r\n 'uses_per_coupon' =&gt; zen_db_prepare_input((int)$_POST['coupon_uses_coupon']),\r\n 'uses_per_user' =&gt; zen_db_prepare_input((int)$_POST['coupon_uses_user']),\r\n 'coupon_minimum_order' =&gt; zen_db_prepare_input((float)$_POST['coupon_min_order']),\r\n 'restrict_to_products' =&gt; zen_db_prepare_input($_POST['coupon_products']),\r\n 'restrict_to_categories' =&gt; zen_db_prepare_input($_POST['coupon_categories']),\r\n 'coupon_start_date' =&gt; $_POST['coupon_startdate'],\r\n 'coupon_expire_date' =&gt; $_POST['coupon_finishdate'],\r\n 'date_created' =&gt; 'now()',\r\n 'date_modified' =&gt; 'now()',\r\n 'coupon_zone_restriction' =&gt; $_POST['coupon_zone_restriction']);<\/pre>\n<p>Add after:<\/p>\n<pre lang=\"php\" line=\"249\" escaped=\"true\">if ( (date('Y-m-d',time()) &gt;= $_POST['coupon_startdate']) &amp;&amp; ( (date('Y-m-d',time()) &lt; $_POST['coupon_finishdate']) || !isset($_POST['coupon_finishdate']) ) $sql_data_array['coupon_active'] = 'Y';<\/pre>\n<p>I love Zen Cart, but seriously, something like this should have been fixed a lot sooner&#8230;<\/p>\n<p><script type=\"application\/ld+json\">\n      {\n        \"@context\": \"http:\/\/schema.org\",\n        \"@type\": \"NewsArticle\",\n\t\"dateModified\": \"https:\/\/calendar.google.com\/calendar\/r\/day\/2019\/5\/29\",\n\t\"mainEntityOfPage\": \"https:\/\/www.numinix.com\/wordpress\/2010\/10\/07\/how-to-make-an-inactive-coupon-active\/\",\n\"author\": {\n    \"@type\": \"Person\",\n    \"name\": \"Jeff Lew\"\n  },\n   \"publisher\": {\n    \"@type\": \"Organization\",\n    \"name\": \"Numinix Web Developers\",\n    \"logo\": {\n      \"@type\": \"ImageObject\",\n      \"url\": \"https:\/\/www.numinix.com\/images\/banner_hero_clarity.png\"\n    }\n    },\n        \"headline\": \"How to Make an Inactive Coupon Active in Zen Cart\",\n        \"datePublished\": \"2010-10-07T16:00:41Z\",\n        \"image\": [\n          \"https:\/\/media.licdn.com\/dms\/image\/C560BAQFjWJ-r6HLAfQ\/company-logo_200_200\/0?e=2159024400&v=beta&t=KzCK1BdfCM48zSzjZ6lsxOsr7sfO0_EVarvyFHWW6H8\"\n        ]\n      }\n    <\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: This article discusses a known bug in Zen Cart that is present in all versions up to and including version 1.3.9g.\u00a0 Hopefully after reading this, the Zen Cart team will implement this simple fix. Today a client was trying to re-enable one of his old coupon codes that had expired by simply changing the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[198,197,72,199,8],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-zen-cart-optimization","tag-active","tag-bug","tag-coupon-code","tag-inactive","tag-zen-cart"],"modified_by":"Numinix Developer","jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/comments?post=440"}],"version-history":[{"count":0,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/media?parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/categories?post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/tags?post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}