We are going to make a number of different products that are one-week free access. They will all have the same name but will redirect to a different "landing page". The problem is when assigning the coupon to a product we get a listing that looks like: Free one week pass Free one week pass Free one week pass Free one week pass There is no way to tell them apart! What is needed is to add the product # to the display to make this simpler. The workaround is to temporarily add the product # to the product description and then remove it after linking the coupon code to it. I think this should be a simple fix, but my programming skills are very rusty. Thanks for any assistance.
Edit /amember/coupons.php and change this : Code: function edit_batch(){ global $db, $t, $vars; $coupons = $db->get_coupons('batch_id', $vars['batch_id']); $batch = $coupons[0]; list($batch['discount_v'], $batch['discount_t']) = split(' ', $batch['discount']); $t->assign('discount_types', array('' => 'USD', '%' => '%')); $products = array(); foreach ($db->get_products_list() as $p) $products[ $p['product_id'] ] = $p['title']; $t->assign('products', $products); $t->assign('batch', $batch); $batch_selected = split(',', $batch['product_id']); $t->assign('batch_selected', $batch_selected); $t->display('admin/coupon_batch_edit.html'); } to Code: function edit_batch(){ global $db, $t, $vars; $coupons = $db->get_coupons('batch_id', $vars['batch_id']); $batch = $coupons[0]; list($batch['discount_v'], $batch['discount_t']) = split(' ', $batch['discount']); $t->assign('discount_types', array('' => 'USD', '%' => '%')); $products = array(); foreach ($db->get_products_list() as $p) $products[ $p['product_id'] ] = $p['title']." ".$p['product_id']; $t->assign('products', $products); $t->assign('batch', $batch); $batch_selected = split(',', $batch['product_id']); $t->assign('batch_selected', $batch_selected); $t->display('admin/coupon_batch_edit.html'); }
Updated Solution For anyone wanting to add the product number to a scrollable product list box, I now have it working. As far as I can tell, the code needs to be added in four places. You are looking for -- PHP: foreach ($db->get_products_list() as $p) $products[ $p['product_id'] ] = $p['title']; in coupons.php under Code: function display_generate_form() and function edit_batch() in users.php under Code: function display_search_form() and function edit_payment() and change the code to PHP: foreach ($db->get_products_list() as $p) $products[ $p['product_id'] ] = $p['title']." ".$p['product_id'];
I now find that I need to add the product ID to payments.php but it uses different programming than a scrollable list box. Code: $t->assign('q_where_options', array( '' => 'Search entire payment record', 'receipt_id' => 'Receipt# (returned by payment system)', 'payment_id' => 'Payment# (generated by aMember)', 'login' => 'Username', 'login_part' => 'Part of username', 'amount' => 'Payment amount', 'remote_addr'=> 'Client IP', [COLOR="red"] 'product' => 'Product Title',[/COLOR] I need to add the product_id to the product title so I can tell at one glance which identically named product was chosen but haven't had any luck in doing so. Any further suggestions? Thanks.
Do you need to add it to add payment form? Or payments list? Above code is related to search options, it does not display product title at all.
Ok, here's what I am referring to: apparently the product display resides in another program. I need to add the product ID after the product name similar to how it was done in the code earlier in this thread. This displays when payments.php is run. Thanks.
It's in the mysql.inc.php function get_payments. You can change SQL query: Code: $q = $this->query($s = "SELECT p.*, m.login as member_login, pr.title as product_title $coupon_fields FROM {$this->config['prefix']}payments p LEFT JOIN {$this->config['prefix']}members m USING (member_id) LEFT JOIN {$this->config['prefix']}products pr ON (p.product_id = pr.product_id) $coupon_join WHERE $search_add $where_add $src_pr ORDER BY p.begin_date DESC $limit_exp "); to Code: $q = $this->query($s = "SELECT p.*, m.login as member_login, concat(pr.title, pr.product_id) as product_title $coupon_fields FROM {$this->config['prefix']}payments p LEFT JOIN {$this->config['prefix']}members m USING (member_id) LEFT JOIN {$this->config['prefix']}products pr ON (p.product_id = pr.product_id) $coupon_join WHERE $search_add $where_add $src_pr ORDER BY p.begin_date DESC $limit_exp ");
Thanks, this works well for me. For others that want to make a similar mod, mysql.inc.php is located in the \plugins\db\mysql folder. I made one minor change and added a space after the product_title so it doesn't run into the product_id. Code: concat(pr.title,' ',pr.product_id) as product_title
We find this very helpful as we can see at one glance what product was used to sign-up with. Since there are identical product names, all saying "one free week", this eliminates digging into the user details to see the coupon code which would identify the sign-up type and if they used the common sign-up page or a customized one.