-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Нумерация заказа MS2 #393
Нумерация заказа MS2 #393
Changes from 5 commits
484d304
b05f83e
becfef0
1dcc39b
2f52899
99f05aa
e09599b
bf02a3d
f0283eb
7e42ca5
50ff705
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -596,7 +596,15 @@ public function getCost($with_cart = true, $only_cost = false) | |
*/ | ||
public function getNum() | ||
{ | ||
$cur = date('ym'); | ||
$formatNum = htmlspecialchars($this->modx->getOption('ms2_order_format_num', null, '%y%m')); | ||
$formatNumSeparator = trim(preg_replace("/[^,\/\-]/", '', "\/")); | ||
|
||
if ($formatNum){ | ||
$cur = strftime($formatNum); | ||
}else{ | ||
$cur = date('ym'); | ||
} | ||
CrazyBoy49z marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$num = 0; | ||
|
||
$c = $this->modx->newQuery('msOrder'); | ||
|
@@ -608,10 +616,10 @@ public function getNum() | |
$num = $c->stmt->fetchColumn(); | ||
} | ||
if (empty($num)) { | ||
$num = date('ym') . '/0'; | ||
$num = "{$cur}{$formatNumSeparator}0"; | ||
Ibochkarev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
$num = explode('/', $num); | ||
$num = $cur . '/' . ($num[1] + 1); | ||
$num = explode($formatNumSeparator, $num); | ||
$num = "{$cur}{$formatNumSeparator}" . ($num[1] + 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Дикое переопределение переменных. Можно переписать чуть более наглядно. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Поправлю только, доберусь, ошибки есть так набросал в браузере, я б совсем завел новое поле в таблице на количество, но думаю это уже нужно будет добавить в minishop3 |
||
|
||
return $num; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно из опции тоже вытаскивать, а то опция как бы есть, но бесполезна.