Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
zendframework1
library
Zend
Validate
Barcode
Issn.php
Go to the documentation of this file.
1
<?php
25
#require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
26
33
class
Zend_Validate_Barcode_Issn
extends
Zend_Validate_Barcode_AdapterAbstract
34
{
39
protected
$_length
= array(8, 13);
40
45
protected
$_characters
=
'0123456789X'
;
46
51
protected
$_checksum
=
'_gtin'
;
52
59
public
function
checkChars
(
$value
)
60
{
61
if
(strlen(
$value
) != 8) {
62
if
(strpos(
$value
,
'X'
) !==
false
) {
63
return
false
;
64
}
65
}
66
67
return
parent::checkChars(
$value
);
68
}
69
76
public
function
checksum
(
$value
)
77
{
78
if
(strlen(
$value
) == 8) {
79
$this->_checksum =
'_issn'
;
80
}
else
{
81
$this->_checksum =
'_gtin'
;
82
}
83
84
return
parent::checksum(
$value
);
85
}
86
94
protected
function
_issn
(
$value
)
95
{
96
$checksum = substr(
$value
, -1, 1);
97
$values
= str_split(substr(
$value
, 0, -1));
98
$check = 0;
99
$multi = 8;
100
foreach
(
$values
as
$token
) {
101
if
(
$token
==
'X'
) {
102
$token
= 10;
103
}
104
105
$check += (
$token
* $multi);
106
--$multi;
107
}
108
109
$check %= 11;
110
$check = 11 - $check;
111
if
($check == $checksum) {
112
return
true
;
113
}
else
if
(($check == 10) && ($checksum ==
'X'
)) {
114
return
true
;
115
}
116
117
return
false
;
118
}
119
}
Zend_Validate_Barcode_AdapterAbstract
Definition:
AdapterAbstract.php:33
Zend_Validate_Barcode_Issn\$_length
$_length
Definition:
Issn.php:39
$values
$values
Definition:
options.phtml:88
$token
$token
Definition:
fake_payment_token.php:14
$value
$value
Definition:
gender.phtml:16
Zend_Validate_Barcode_Issn\checksum
checksum($value)
Definition:
Issn.php:76
Zend_Validate_Barcode_Issn\checkChars
checkChars($value)
Definition:
Issn.php:59
Zend_Validate_Barcode_Issn\_issn
_issn($value)
Definition:
Issn.php:94
Zend_Validate_Barcode_Issn
Definition:
Issn.php:33
Zend_Validate_Barcode_Issn\$_checksum
$_checksum
Definition:
Issn.php:51
Zend_Validate_Barcode_Issn\$_characters
$_characters
Definition:
Issn.php:45