0

i have Magento 2.3 and i want to manage customer wishlist via database. I understand how it works but i don't know how can i generate sharing_code on my php script.

Thanks

Antonello

0

1 Answer 1

1

In Magento Wishlist share code is Unique.

When Customer was created at that time one row also created in wishlist Table and here stores Customer id

in wishlist table has one Unique wishlist id and also have one Unique sharing code.

If Login customer share wishlist then you have get login customer id and from this customer id you need to get sharing code from wishlist Table.

Note: You don't need to create sharing code because it generate when customer is created.

If you need to create sharing code then you need to do via php string function the try this code

$length = 8; // for how many character/number allow
$str = '';
$keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$max = mb_strlen($keyspace, '8bit') - 1;
for ($i = 0; $i < $; ++$i) {
    $str .= $keyspace[random_int(0, $max)];
}

print_r($str); // sharing code

I Hope This Helps You

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.