hi guys, how to make unique code in price product for example, my product price is $ 400 if buyer click my product, the invoice total calculate is $ 401 and if other buyer click buy again, the invoice total calculate is $ 402 and more so how to add automatic unique code number in last price product ? at all, thanks alot
Hello, I am afraid it is not possible by default but I believe it is possible to implement custom plugin to accomplish such feature. Do you mind to contact us in helpdesk? https://www.amember.com/support We will help you with it. Best Regards.
Hai, insert this code in file site.php http://www.amember.com/docs/Site.php_file PHP: Am_Di::getInstance()->hook->add(Am_Event::INVOICE_CALCULATE, function(Am_Event $e) { if (@$GLOBALS['add_fraction']++) return; $invoice = $e->getInvoice(); $item = $invoice->getItem(0); $id = $invoice->pk() ?: $e->getDi()->db->selectCell("SELECT MAX(invoice_id)+1 FROM ?_invoice;"); if ($item && !$item->data()->get('add_fraction')) { $item->data()->set('add_fraction', 1); $item->data()->set('orig_first_price', $item->data()->get('orig_first_price') + ($id % 100)); $invoice->calculate(); } unset($GLOBALS['add_fraction']);});
makasih @masdika untuk jawabannya. lalu cara me reset agar unik kode kembali ke nol lagi gimana ya mas. itukan nnti kalo ada 10.000 orang yg regist di amember saya, otomatis harga produk nambah Rp 10.000,- buyer jadi mikir 2x buat beli produk saya entar
This code automatically reset it to 0 after 100 order. Please note this code: PHP: $id % 100 result of this operation is always between 0 and 99
Itu sudah di jelaskan oleh Uncle@caesar Kalau mau diskusi bisa add facebook saya facebook.com/masdikacom om @williambangwill
@akuraid You need to replace code PHP: if ($item && !$item->data()->get('add_fraction')) { with PHP: if ($item && $item->first_price > 0 && !$item->data()->get('add_fraction')) { It should do the job.