user gets account creation email but cannot login

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
obayesshelton
Posts: 21
Joined: 12 Oct 2015, 12:31
Location: London, UK
Contact:

user gets account creation email but cannot login

Post by obayesshelton » 08 Dec 2015, 14:29

Hey,

So the user get's an email with their password and username however when I look into the users table there isn't anything.

Do I need to configure anything?

I noticed symfony users FOS do I need to do any such integration?

Oliver

User avatar
aimeos
Administrator
Posts: 3097
Joined: 01 Jan 1970, 00:00

Re: user gets account creation email but cannot login

Post by aimeos » 09 Dec 2015, 10:29

obayesshelton wrote: So the user get's an email with their password and username however when I look into the users table there isn't anything. Do I need to configure anything?
The demo (http://laravel.demo.aimeos.org) stores the new user accounts like expected. Which version of the aimeos-laravel package are you using?

Can you please check that the Aimeos migrations for the "users" table have been executed? There must be around 29 columns in this table.
obayesshelton wrote: I noticed symfony users FOS do I need to do any such integration?
No, Laravel already includes the necessary functionality for user registration and login. In Symfony, you need an extra bundle for this.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

brunojti
Posts: 27
Joined: 29 Jul 2016, 14:02
Location: Brazil

Re: user gets account creation email but cannot login

Post by brunojti » 01 Sep 2016, 13:44

Hi,

I am trying to add some fields to Users table like: taxpayerid, phone's area code, neighborhood. And edit some fields: Address1 to Street, Address2 to Number, Address3 to complement.

As I am still learning, I'm taking baby steps, and decided to add only taxpayer id to figure out the whole process for adding the new field.

I've created a setup task to add taxpayerid to mshop_order_base_address:

Code: Select all

<?php
namespace Aimeos\MW\Setup\Task;

class OrderAddTaxPayerIdColumn extends Base
{

    private $table_name = 'mshop_order_base_address';

    private $migrate = array(
        'mysql' => 'ALTER TABLE "mshop_order_base_address" ADD "taxpayerid" VARCHAR(32) NOT NULL COLLATE utf8_bin AFTER "title"',
    );

    private $rollback = array(
        'mysql' => 'ALTER TABLE "mshop_order_base_address" ADD "taxpayerid" VARCHAR(32) NOT NULL COLLATE utf8_bin AFTER "title"',
    );

    /**
     * Returns the list of task names which this task depends on.
     *
     * @return array List of task names
     */
    public function getPreDependencies()
    {
        return array('OrderRenameTables');
    }

    /**
     * Returns the list of task names which depends on this task.
     *
     * @return array List of task names
     */
    public function getPostDependencies()
    {
        return array('TablesCreateMShop');
    }

    public function migrate()
    {
        $this->msg('Adding taxpayerid column to order base address table', 0);

        $schema = $this->getSchema('db-order');

        if (isset($this->migrate[$schema->getName()])
            && $schema->tableExists($this->table_name) === true
            && $schema->columnExists($this->table_name, 'taxpayerid') === false
        ) {
            $this->execute($this->migrate[$schema->getName()]);
            $this->status('done');
        } else {
            $this->status('OK');
        }
    }

    public function rollback()
    {
        $this->msg('Rollback: Adding taxpayerid column to order base address table', 0);

        $schema = $this->getSchema('db-order');

        if (isset($this->rollback[$schema->getName()])
            && $schema->tableExists($this->table_name) === true
            && $schema->columnExists($this->table_name, 'taxpayer_id') === true
        ) {
            $this->execute($this->rollback[$schema->getName()]);
            $this->status('done');
        } else {
            $this->status('OK');
        }
    }
}
But now I am a bit lost...
You said:
Can you please check that the Aimeos migrations for the "users" table have been executed? There must be around 29 columns in this table.
So now i need to find a way to add `taxpayerid` field to users table.

In pure laravel, I would need to add the `taxpayerid` field to $fillable array in User model, add the input to the form in view and make sure that the Controller passes the value to the model.

What about in aimeos? I've managed to have the field added to my DB. What are the next steps to make it work for the final user?

Thanks

brunojti
Posts: 27
Joined: 29 Jul 2016, 14:02
Location: Brazil

Re: user gets account creation email but cannot login

Post by brunojti » 02 Sep 2016, 01:21

I've found the following partial:

Code: Select all

client/html/templates/common/partials/address-default.php
.

But everything is hard coded, Am I looking in the wrong place?

Thanks

User avatar
aimeos
Administrator
Posts: 3097
Joined: 01 Jan 1970, 00:00

Re: user gets account creation email but cannot login

Post by aimeos » 02 Sep 2016, 08:04

What do you want to achieve? Add a new user address column whose value is added to the address of each order?

In this case, your setup task for the "mshop_order_base_address" table is correct (besides the rollback section). For the Laravel user table you can create a Laravel migration scripts because that table is managed by Laravel, not by Aimeos.

The next steps are to extend the customer and order base address items and add the get/set Methods for the new property. Extend their managers as well an overwrite the saveItem() and createItemBase() methods to save the new property and use your new item class.

In a last step, you should adapt the address partial you've found and extend the checkout standard address billing/delivery classes to add the input of the customers to the address object in the basket.

BTW: It doesn't make much sense to rename columns. The address* columns are named so to be generic enough for every area in the world. For the tax payer ID, there's already a field called "vatid".
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

brunojti
Posts: 27
Joined: 29 Jul 2016, 14:02
Location: Brazil

Re: user gets account creation email but cannot login

Post by brunojti » 02 Sep 2016, 19:14

I've done some progress here, and now I need to update this line:

https://github.com/aimeos/ai-client-htm ... d.php#L472

But I'm not being able to overwrite it in my extension. I've created a file located at `ext/my-ext/client/html/src/Client/Html/Checkout/Standard/Address/Billing/Standard.php`.

Copied the whole file, edited the line 472 to

Code: Select all

$params['order.base.address.company'] = '';
, set breakpoints in both files and the file from `ai-client-html` is getting called. How can I load my custom file?

Thanks for your help, I wouldn't evolve without your commitment ;)

User avatar
aimeos
Administrator
Posts: 3097
Joined: 01 Jan 1970, 00:00

Re: user gets account creation email but cannot login

Post by aimeos » 02 Sep 2016, 20:53

Classes are not overwritten by copying them. Instead, you have to extend from the class (name it e.g. Myext.php and extend from Standard.php), overwrite only the part you want to change (the checkSalutation() method) and configure the new class name so the factory will create your new class instead:
https://aimeos.org/docs/Configuration/C ... lling/name

We want your knowledge to increase so you will be able to share your experience here in the future :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

brunojti
Posts: 27
Joined: 29 Jul 2016, 14:02
Location: Brazil

Re: user gets account creation email but cannot login

Post by brunojti » 03 Sep 2016, 00:00

I'll be glad to help here in the Forums ;)

I was able to extend `Standard.php` using https://aimeos.org/docs/Configuration/C ... lling/name

Now my problem is extending Items and Managers, I just re-read the docs about this and found no reference on how to extend them...

Tried to set the following option on config/shop.php but no luck yet...

Code: Select all

 
'mshop' => array(
        'common' => array(
            'item' => array(
                'address' => array(
                    'name' => 'AddressBase'
...
My new class: `ext/my-ext/lib/custom/src/Mshop/Common/Item/Address/AddressBase.php`:

Code: Select all

namespace Aimeos\MShop\Common\Item\Address;

/**
 * Abstract class for address items.
 *
 * @package MShop
 * @subpackage Common
 */
class AddressBase
    extends \Aimeos\MShop\Common\Item\Address\Base
    implements \Aimeos\MShop\Common\Item\Address\Iface
{
...
Inside the class I've overwritten `fromArray` but it never gets touched.
What am I missing here?

Thanks. :mrgreen:

User avatar
aimeos
Administrator
Posts: 3097
Joined: 01 Jan 1970, 00:00

Re: user gets account creation email but cannot login

Post by aimeos » 03 Sep 2016, 09:34

First, you shouldn't name a class "...Base" because that name is already used for abstract classes.
The, extend your new class from the standard class because it already contains everything you need besides your new properties:

Code: Select all

class Myext extends \Aimeos\MShop\Customer\Item\Address\Standard
{
}
To use your new item class, overwrite the createItemBase() method in your new manager.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

brunojti
Posts: 27
Joined: 29 Jul 2016, 14:02
Location: Brazil

Re: user gets account creation email but cannot login

Post by brunojti » 05 Sep 2016, 14:15

I've changed my files but the core's `fromArray` method is still called in `vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Order/Item/Base/Address/Standard.php`...

`ext/my/myext/lib/custom/src/Mshop/Order/Item/Base/Address/CustomAddress.php`

Code: Select all

namespace Aimeos\MShop\Order\Item\Base\Address;

class CustomAddress extends \Aimeos\MShop\Order\Item\Base\Address\Standard
    implements \Aimeos\MShop\Order\Item\Base\Address\Iface
{
    public function fromArray(array $list)
    {
...
`config/shop.php`

Code: Select all

'mshop' => array(
        'order' => array(
            'item' => array(
                'address' => array(
                    'name' => 'CustomAddress'
                )
            )
        ),
...
I just can't find out what I am missing here. :(

Post Reply