How to add additional fields to a customer

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: How to add additional fields to a customer

Post by mohal_04 » 06 Apr 2018, 09:13

aimeos wrote:The problem is most probably that the price panel is using Vue.JS to render the data and you have to extend the JS code too to get it working: https://github.com/aimeos/ai-admin-jqad ... ux.js#L264
Hi,

Thanks for the reply!

Ooops... I have no experience of Vue.js. Can you guide me with any documentation that how I can extend the Vue.js code? I really appreciate your help.

Thanks!

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

Re: How to add additional fields to a customer

Post by aimeos » 06 Apr 2018, 10:15

You can find documentation about Vue.JS there: https://vuejs.org/
You don't need that much knowledge about Vue.JS. There are only three important things:

1.) Add the new key in your new template there:
https://github.com/aimeos/ai-admin-jqad ... rd.php#L11

2.) Copy the form line and replace "price.value" by your new key:
https://github.com/aimeos/ai-admin-jqad ... rd.php#L70

3.) Check if your new key/value is listed there (use the web inspector for example):
https://github.com/aimeos/ai-admin-jqad ... rd.php#L23
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: How to add additional fields to a customer

Post by mohal_04 » 06 Apr 2018, 11:06

aimeos wrote:You can find documentation about Vue.JS there: https://vuejs.org/
You don't need that much knowledge about Vue.JS. There are only three important things:

1.) Add the new key in your new template there:
https://github.com/aimeos/ai-admin-jqad ... rd.php#L11

2.) Copy the form line and replace "price.value" by your new key:
https://github.com/aimeos/ai-admin-jqad ... rd.php#L70

3.) Check if your new key/value is listed there (use the web inspector for example):
https://github.com/aimeos/ai-admin-jqad ... rd.php#L23
Hi,

I think there is a problem. I think the examples you sent me are for latest Aimeos version. I am working in Aimeos 2017.10. And the files you mentioned are not present or have different code.

Plus, I comment update code in admin-vux.php file and the default fields were still able to save value.

Kindly, spare some more time to help me with this.

Thanks!

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

Re: How to add additional fields to a customer

Post by aimeos » 06 Apr 2018, 13:15

In this case, you should only have to add two new input fields to the template (regular and prototype block).

There's one minor issue in the search SQL: In the GROUP BY you should also add the new field.

If you are unsure if your manager is used, add a

Code: Select all

error_log( __METHOD__ )
to the code that is expected to be executed. Then you can see if it's used or not. The second thing is to see if the data is saved to the database and if yes, if there's a problem either in fetching or displaying the data. If not, add some debug statements to the saveItem() method of your price manager to see what's happinging.

In general, error_log() is always a good friend to see what happens :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: How to add additional fields to a customer

Post by mohal_04 » 09 Apr 2018, 06:07

aimeos wrote:In this case, you should only have to add two new input fields to the template (regular and prototype block).

There's one minor issue in the search SQL: In the GROUP BY you should also add the new field.

If you are unsure if your manager is used, add a

Code: Select all

error_log( __METHOD__ )
to the code that is expected to be executed. Then you can see if it's used or not. The second thing is to see if the data is saved to the database and if yes, if there's a problem either in fetching or displaying the data. If not, add some debug statements to the saveItem() method of your price manager to see what's happinging.

In general, error_log() is always a good friend to see what happens :-)
Hi,

I really appreciate your help. error_log() is also not helping :(. Did you look at the code I posted previously...

post5963.html#p5963

I need confirmation about configuration file. Have I configured the second manager (price) correctly because application is not recognizing it. I have inserted error_log(__METHOD__) in different methods but non of them is getting called. So, if you could look into the configuration file once again then it would be a great help. I am pasting its code here again...

./ext/myextension/lib/custom/config/mshop.php

Code: Select all

return [
    'product' => [
        'manager' => [
            'name' => 'Abc',
            'standard' => [
				'insert' => array(
					'ansi' => '
						INSERT INTO "mshop_product" (
							"countryoforigin", "oldcode", "typeid", "code", "label", "status", "start", "end",
							"config", "mtime", "editor", "target", "siteid", "ctime"
						) VALUES (
							?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
						)
					'
				),
				'update' => array(
					'ansi' => '
						UPDATE "mshop_product"
						SET "countryoforigin" = ?, "oldcode" = ?, "typeid" = ?, "code" = ?, "label" = ?, "status" = ?,
							"start" = ?, "end" = ?, "config" = ?, "mtime" = ?, "editor" = ?, "target" = ?
						WHERE "siteid" = ? AND "id" = ?
					'
				),
				'search' => array(
					'ansi' => '
						SELECT mpro."id" AS "product.id", mpro."siteid" AS "product.siteid",
							mpro."typeid" AS "product.typeid", mpro."code" AS "product.code",
							mpro."label" AS "product.label", mpro."config" AS "product.config",
							mpro."start" AS "product.datestart", mpro."end" AS "product.dateend",
							mpro."status" AS "product.status", mpro."ctime" AS "product.ctime",
							mpro."mtime" AS "product.mtime", mpro."editor" AS "product.editor",
							mpro."target" AS "product.target",
							mpro."oldcode" AS "product.oldcode",
							mpro."countryoforigin" AS "product.countryoforigin"
						FROM "mshop_product" AS mpro
						:joins
						WHERE :cond
						GROUP BY mpro."id", mpro."siteid", mpro."typeid", mpro."code",
							mpro."label", mpro."config", mpro."start", mpro."end",
							mpro."status", mpro."ctime", mpro."mtime", mpro."editor",
							mpro."target", mpro."oldcode", mpro."countryoforigin"
							/*-columns*/ , :columns /*columns-*/
						/*-orderby*/ ORDER BY :order /*orderby-*/
						LIMIT :size OFFSET :start
					'
				),
				'count' => array(
					'ansi' => '
						SELECT COUNT(*) AS "count"
						FROM (
							SELECT DISTINCT mpro."id"
							FROM "mshop_product" AS mpro
							:joins
							WHERE :cond
							LIMIT 10000 OFFSET 0
						) AS list
					'
				),
				'newid' => array(
					'db2' => 'SELECT IDENTITY_VAL_LOCAL()',
					'mysql' => 'SELECT LAST_INSERT_ID()',
					'oracle' => 'SELECT mshop_product_seq.CURRVAL FROM DUAL',
					'pgsql' => 'SELECT lastval()',
					'sqlite' => 'SELECT last_insert_rowid()',
					'sqlsrv' => 'SELECT SCOPE_IDENTITY()',
					'sqlanywhere' => 'SELECT @@IDENTITY',
				),
            ],
        ],
    ],
    'price' => [
        'manager' => [
            'name' => 'Cde',
            'standard' => [
				'insert' => array(
					'ansi' => '
						INSERT INTO "mshop_price" (
							"minimumadvertisedprice", "typeid", "currencyid", "domain", "label",
							"quantity", "value", "costs", "rebate", "taxrate",
							"status", "mtime", "editor", "siteid", "ctime"
						) VALUES (
							?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
						)
					'
				),
				'update' => array(
					'ansi' => '
						UPDATE "mshop_price"
						SET "minimumadvertisedprice" = ?, "typeid" = ?, "currencyid" = ?, "domain" = ?, "label" = ?,
							"quantity" = ?, "value" = ?, "costs" = ?, "rebate" = ?,
							"taxrate" = ?, "status" = ?, "mtime" = ?, "editor" = ?
						WHERE "siteid" = ? AND "id" = ?
					'
				),
				'search' => array(
					'ansi' => '
						SELECT mpri."id" AS "price.id", mpri."siteid" AS "price.siteid",
							mpri."typeid" AS "price.typeid", mpri."currencyid" AS "price.currencyid",
							mpri."domain" AS "price.domain", mpri."label" AS "price.label",
							mpri."quantity" AS "price.quantity", mpri."value" AS "price.value",
							mpri."costs" AS "price.costs", mpri."rebate" AS "price.rebate",
							mpri."taxrate" AS "price.taxrate", mpri."status" AS "price.status",
							mpri."mtime" AS "price.mtime", mpri."editor" AS "price.editor",
							mpri."ctime" AS "price.ctime",
							mpri."minimumadvertisedprice" AS "price.minimumadvertisedprice"
						FROM "mshop_price" AS mpri
						:joins
						WHERE :cond
						GROUP BY mpri."id", mpri."siteid", mpri."typeid", mpri."currencyid",
							mpri."domain", mpri."label", mpri."quantity", mpri."value",
							mpri."costs", mpri."rebate", mpri."taxrate", mpri."status",
							mpri."mtime", mpri."editor", mpri."ctime", mpri."minimumadvertisedprice" /*-columns*/ , :columns /*columns-*/
						/*-orderby*/ ORDER BY :order /*orderby-*/
						LIMIT :size OFFSET :start
					'
				),
				'count' => array(
					'ansi' => '
						SELECT COUNT(*) AS "count"
						FROM (
							SELECT DISTINCT mpri."id"
							FROM "mshop_price" AS mpri
							:joins
							WHERE :cond
							LIMIT 10000 OFFSET 0
						) AS list
					'
				),
				'newid' => array(
					'db2' => 'SELECT IDENTITY_VAL_LOCAL()',
					'mysql' => 'SELECT LAST_INSERT_ID()',
					'oracle' => 'SELECT mshop_price_seq.CURRVAL FROM DUAL',
					'pgsql' => 'SELECT lastval()',
					'sqlite' => 'SELECT last_insert_rowid()',
					'sqlsrv' => 'SELECT SCOPE_IDENTITY()',
					'sqlanywhere' => 'SELECT @@IDENTITY',
				),
            ],
        ],
    ],
];
Thanks!

P.S. Laravel: 5.6, Aimeos: 2017.10

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: How to add additional fields to a customer

Post by mohal_04 » 09 Apr 2018, 06:27

aimeos wrote:In this case, you should only have to add two new input fields to the template (regular and prototype block).

There's one minor issue in the search SQL: In the GROUP BY you should also add the new field.
Hi,

I have added new field in GROUP BY but I think GROUP BY would not be affecting data save and retrieve.

About regular and prototype block, please, explain what do you mean by this. I have added html code for the new field in the template file, which is item-price-default.php under the default field of "Actual current price."

You can check the code...

./ext/myextenstion/admin/jqadm/templates/product/item-price-default.php

Code: Select all


/**
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
 * @copyright Aimeos (aimeos.org), 2015-2017
 */

$enc = $this->encoder();


?>
<div id="price" class="item-price content-block tab-pane fade" role="tablist" aria-labelledby="price">
	<div id="item-price-group" role="tablist" aria-multiselectable="true">

		<?php foreach( (array) $this->get( 'priceData/price.currencyid', [] ) as $idx => $currencyid ) : ?>

			<div class="group-item card <?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?>">
				<input class="item-listid" type="hidden" name="<?= $enc->attr( $this->formparam( array( 'price', 'product.lists.id', '' ) ) ); ?>"
					value="<?= $enc->attr( $this->get( 'priceData/product.lists.id/' . $idx ) ); ?>" />

				<div id="item-price-group-item-<?= $enc->attr( $idx ); ?>" class="card-header header  <?= ( $idx !== 0 ? 'collapsed' : '' ); ?>" role="tab"
					data-toggle="collapse" data-target="#item-price-group-data-<?= $enc->attr( $idx ); ?>"
					aria-expanded="false" aria-controls="item-price-group-data-<?= $enc->attr( $idx ); ?>">
					<div class="card-tools-left">
						<div class="btn btn-card-header act-show fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
							title="<?= $enc->attr( $this->translate( 'admin', 'Show/hide this entry') ); ?>">
						</div>
					</div>
					<span class="item-label header-label"><?= $enc->html( $this->get( 'priceData/price.label/' . $idx ) ); ?></span>
					&nbsp;
					<div class="card-tools-right">
						<?php if( !$this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ) ) : ?>
							<div class="btn btn-card-header act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
								title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>">
							</div>
						<?php endif; ?>
					</div>
				</div>

				<div id="item-price-group-data-<?= $enc->attr( $idx ); ?>" class="card-block collapse row <?= ( $idx === 0 ? 'show' : '' ); ?>"
					role="tabpanel" aria-labelledby="item-price-group-item-<?= $enc->attr( $idx ); ?>">

					<div class="col-xl-6">
						<div class="form-group row mandatory">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Tax rate in %' ) ); ?></label>
							<div class="col-sm-8">
								<input class="form-control item-taxrate" type="number" step="0.01" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.taxrate', '' ) ) ); ?>"
									placeholder="<?= $enc->attr( $this->translate( 'admin', 'Tax rate in %' ) ); ?>"
									value="<?= $enc->attr( $this->get( 'priceData/price.taxrate/' . $idx, 0 ) ); ?>"
									<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> />
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Country specific tax rate to calculate and display the included tax (B2C) or add the tax if required (B2B)' ) ); ?>
							</div>
						</div>
						<div class="form-group row mandatory">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Actual current price' ) ); ?></label>
							<div class="col-sm-8">
								<input class="form-control item-value" type="number" step="0.01" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.value', '' ) ) ); ?>"
									placeholder="<?= $enc->attr( $this->translate( 'admin', 'Actual current price' ) ); ?>"
									value="<?= $enc->attr( $this->get( 'priceData/price.value/' . $idx, '0.00' ) ); ?>"
									<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> />
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Actual price customers can buy the article for on the web site' ) ); ?>
							</div>
						</div>
						<!-- Umer - Cost - Starts -->
						<div class="form-group row">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Minimum Advertised Price' ) ); ?></label>
							<div class="col-sm-8">
								<input class="form-control item-value" type="number" step="0.01" tabindex="<?= $this->get( 'tabindex' ); ?>"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.minimumadvertisedprice', '' ) ) ); ?>"
									placeholder="<?= $enc->attr( $this->translate( 'admin', 'Minimum Advertised Price' ) ); ?>"
									value="<?= $enc->attr( $this->get( 'priceData/price.minimumadvertisedprice/' . $idx, '0.00' ) ); ?>"
									<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> />
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Minimum Advertised Price for the article' ) ); ?>
							</div>
						</div>
						<!-- Umer - Cost - Ends -->
						<div class="form-group row optional">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Substracted rebate amount' ) ); ?></label>
							<div class="col-sm-8">
								<input class="form-control item-rebate" type="number" step="0.01"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.rebate', '' ) ) ); ?>" tabindex="<?= $this->get( 'tabindex' ); ?>"
									placeholder="<?= $enc->attr( $this->translate( 'admin', 'Substracted rebate amount' ) ); ?>"
									value="<?= $enc->attr( $this->get( 'priceData/price.rebate/' . $idx, '0.00' ) ); ?>"
									<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> />
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Reduction from the original price, used to calculate the rebate in % and the cross price' ) ); ?>
							</div>
						</div>
						<div class="form-group row optional">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Shipping costs per item' ) ); ?></label>
							<div class="col-sm-8">
								<input class="form-control item-costs" type="number" step="0.01"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.costs', '' ) ) ); ?>" tabindex="<?= $this->get( 'tabindex' ); ?>"
									placeholder="<?= $enc->attr( $this->translate( 'admin', 'Shipping costs per item' ) ); ?>"
									value="<?= $enc->attr( $this->get( 'priceData/price.costs/' . $idx, '0.00' ) ); ?>"
									<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> />
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Additional delivery costs for each item, e.g. $20 for one heavy item will be $100 for five items it total' ) ); ?>
							</div>
						</div>
					</div>

					<div class="col-xl-6">

						<?php $currencies = $this->get( 'priceCurrencies', [] ); ?>
						<?php if( count( $currencies ) > 1 ) : ?>
							<div class="form-group row mandatory">
								<label class="col-sm-4 form-control-label"><?= $enc->html( $this->translate( 'admin', 'Currency' ) ); ?></label>
								<div class="col-sm-8">
									<select class="form-control custom-select item-currencyid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
										name="<?= $enc->attr( $this->formparam( array( 'price', 'price.currencyid', '' ) ) ); ?>"
										<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> >
										<option value="">
											<?= $enc->attr( $this->translate( 'admin', 'Please select' ) ); ?>
										</option>

										<?php foreach( $currencies as $currencyItem ) : ?>
											<option value="<?= $enc->attr( $currencyItem->getCode() ); ?>" <?= ( $currencyid == $currencyItem->getCode() ? 'selected="selected"' : '' ) ?> >
												<?= $enc->html( $currencyItem->getCode() ); ?>
											</option>
										<?php endforeach; ?>

									</select>
								</div>
							</div>
						<?php else : ?>
							<input class="item-currencyid" type="hidden"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.currencyid', '' ) ) ); ?>"
								value="<?= $enc->attr( $currencyid ); ?>" />
						<?php endif; ?>

						<?php $priceTypes = $this->get( 'priceTypes', [] ); ?>
						<?php if( count( $priceTypes ) > 1 ) : ?>
							<div class="form-group row mandatory">
								<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Type' ) ); ?></label>
								<div class="col-sm-8">
									<select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
										name="<?= $enc->attr( $this->formparam( array( 'price', 'price.typeid', '' ) ) ); ?>"
										<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> >
										<option value="">
											<?= $enc->attr( $this->translate( 'admin', 'Please select' ) ); ?>
										</option>

										<?php foreach( (array) $priceTypes as $typeId => $typeItem ) : ?>
											<option value="<?= $enc->attr( $typeId ); ?>" <?= ( $typeId == $this->get( 'priceData/price.typeid/' . $idx ) ? 'selected="selected"' : '' ) ?> >
												<?= $enc->html( $typeItem->getLabel() ); ?>
											</option>
										<?php endforeach; ?>
									</select>
								</div>
								<div class="col-sm-12 form-text text-muted help-text">
									<?= $enc->html( $this->translate( 'admin', 'Types for additional prices like per one lb/kg or per month' ) ); ?>
								</div>
							</div>
						<?php else : $priceType = reset( $priceTypes ); ?>
							<input class="item-typeid" type="hidden"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.typeid', '' ) ) ); ?>"
								value="<?= $enc->attr( $priceType ? $priceType->getId() : '' ); ?>" />
						<?php endif; ?>

						<div class="form-group row mandatory">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Minimum quantity' ) ); ?></label>
							<div class="col-sm-8">
								<input class="form-control item-quantity" type="number" step="1" min="1" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.quantity', '' ) ) ); ?>"
									placeholder="<?= $enc->attr( $this->translate( 'admin', 'Minimum quantity' ) ); ?>"
									value="<?= $enc->attr( $this->get( 'priceData/price.quantity/' . $idx, 1 ) ); ?>"
									<?= $this->site()->readonly( $this->get( 'priceData/product.lists.siteid/' . $idx ) ); ?> />
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Required quantity of articles for block pricing, e.g. one article for $5.00, ten articles for $45.00' ) ); ?>
							</div>
						</div>
					</div>

				</div>

			</div>

		<?php endforeach; ?>

		<div class="group-item card prototype">
			<input class="item-listid" type="hidden" name="<?= $enc->attr( $this->formparam( array( 'price', 'product.lists.id', '' ) ) ); ?>" disabled="disabled" />

			<div id="item-price-group-item-" class="card-header header" role="tab"
				data-toggle="collapse" data-target="#item-price-group-data-">
				<div class="card-tools-left">
					<div class="btn btn-card-header act-show fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
						title="<?= $enc->attr( $this->translate( 'admin', 'Show/hide this entry') ); ?>">
					</div>
				</div>
				<span class="item-label header-label"></span>
				&nbsp;
				<div class="card-tools-right">
					<div class="btn btn-card-header act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
						title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>">
					</div>
				</div>
			</div>

			<div id="item-price-group-data-" class="card-block collapse show row" role="tabpanel">

				<div class="col-xl-6">
					<div class="form-group row mandatory">
						<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Tax rate in %' ) ); ?></label>
						<div class="col-sm-8">
							<input class="form-control item-taxrate" type="number" step="0.01" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.taxrate', '' ) ) ); ?>"
								placeholder="<?= $enc->attr( $this->translate( 'admin', 'Tax rate in %' ) ); ?>" />
						</div>
						<div class="col-sm-12 form-text text-muted help-text">
							<?= $enc->html( $this->translate( 'admin', 'Country specific tax rate to calculate and display the included tax (B2C) or add the tax if required (B2B)' ) ); ?>
						</div>
					</div>
					<div class="form-group row mandatory">
						<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Actual current price' ) ); ?></label>
						<div class="col-sm-8">
							<input class="form-control item-value" type="number" step="0.01" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.value', '' ) ) ); ?>"
								placeholder="<?= $enc->attr( $this->translate( 'admin', 'Actual current price' ) ); ?>" />
						</div>
						<div class="col-sm-12 form-text text-muted help-text">
							<?= $enc->html( $this->translate( 'admin', 'Actual price customers can buy the article for on the web site' ) ); ?>
						</div>
					</div>
					<!-- Umer - Cost - Starts -->
					<div class="form-group row">
						<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Minimum Advertised Price' ) ); ?></label>
						<div class="col-sm-8">
							<input class="form-control item-value" type="number" step="0.01" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.minimumadvertisedprice', '' ) ) ); ?>"
								placeholder="<?= $enc->attr( $this->translate( 'admin', 'Minimum Advertised Price' ) ); ?>" />
						</div>
						<div class="col-sm-12 form-text text-muted help-text">
							<?= $enc->html( $this->translate( 'admin', 'Actual production cost for the article' ) ); ?>
						</div>
					</div>
					<!-- Umer - Cost - Ends -->
					<div class="form-group row optional">
						<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Substracted rebate amount' ) ); ?></label>
						<div class="col-sm-8">
							<input class="form-control item-rebate" type="number" step="0.01" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.rebate', '' ) ) ); ?>"
								placeholder="<?= $enc->attr( $this->translate( 'admin', 'Substracted rebate amount' ) ); ?>" />
						</div>
						<div class="col-sm-12 form-text text-muted help-text">
							<?= $enc->html( $this->translate( 'admin', 'Reduction from the original price, used to calculate the rebate in % and the cross price' ) ); ?>
						</div>
					</div>
					<div class="form-group row optional">
						<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Shipping costs per item' ) ); ?></label>
						<div class="col-sm-8">
							<input class="form-control item-costs" type="number" step="0.01" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.costs', '' ) ) ); ?>"
								placeholder="<?= $enc->attr( $this->translate( 'admin', 'Shipping costs per item' ) ); ?>" />
						</div>
						<div class="col-sm-12 form-text text-muted help-text">
							<?= $enc->html( $this->translate( 'admin', 'Additional delivery costs for each item, e.g. $20 for one heavy item will be $100 for five items it total' ) ); ?>
						</div>
					</div>
				</div>

				<div class="col-xl-6">

					<?php $currencies = $this->get( 'priceCurrencies', [] ); ?>
					<?php if( count( $currencies ) > 1 ) : ?>
						<div class="form-group row">
							<label class="col-sm-4 form-control-label"><?= $enc->html( $this->translate( 'admin', 'Currency' ) ); ?></label>
							<div class="col-sm-8">
								<select class="form-control custom-select item-currencyid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.currencyid', '' ) ) ); ?>">
									<option value="">
										<?= $enc->attr( $this->translate( 'admin', 'Please select' ) ); ?>
									</option>

									<?php foreach( $this->get( 'priceCurrencies', [] ) as $currencyItem ) : ?>
										<option value="<?= $enc->attr( $currencyItem->getCode() ); ?>" >
											<?= $enc->html( $currencyItem->getCode() ); ?>
										</option>
									<?php endforeach; ?>
								</select>
							</div>
						</div>
					<?php else : $currencyItem = reset( $currencies ); ?>
						<input class="item-currencyid" type="hidden" disabled="disabled"
							name="<?= $enc->attr( $this->formparam( array( 'price', 'price.currencyid', '' ) ) ); ?>"
							value="<?= $enc->attr( $currencyItem ? $currencyItem->getId() : '' ); ?>" />
					<?php endif; ?>

					<?php $priceTypes = $this->get( 'priceTypes', [] ); ?>
					<?php if( count( $priceTypes ) > 1 ) : ?>
						<div class="form-group row">
							<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Type' ) ); ?></label>
							<div class="col-sm-8">
								<select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
									name="<?= $enc->attr( $this->formparam( array( 'price', 'price.typeid', '' ) ) ); ?>">
									<option value="">
										<?= $enc->attr( $this->translate( 'admin', 'Please select' ) ); ?>
									</option>

									<?php foreach( (array) $priceTypes as $typeId => $typeItem ) : ?>
										<option value="<?= $enc->attr( $typeId ); ?>" >
											<?= $enc->html( $typeItem->getLabel() ); ?>
										</option>
									<?php endforeach; ?>
								</select>
							</div>
							<div class="col-sm-12 form-text text-muted help-text">
								<?= $enc->html( $this->translate( 'admin', 'Types for additional prices like per one lb/kg or per month' ) ); ?>
							</div>
						</div>
					<?php else : $priceType = reset( $priceTypes ); ?>
						<input class="item-typeid" type="hidden" disabled="disabled"
							name="<?= $enc->attr( $this->formparam( array( 'price', 'price.typeid', '' ) ) ); ?>"
							value="<?= $enc->attr( $priceType ? $priceType->getId() : '' ); ?>" />
					<?php endif; ?>

					<div class="form-group row">
						<label class="col-sm-4 form-control-label help"><?= $enc->html( $this->translate( 'admin', 'Minimum quantity' ) ); ?></label>
						<div class="col-sm-8">
							<input class="form-control item-quantity" type="number" step="1" min="1" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" disabled="disabled"
								name="<?= $enc->attr( $this->formparam( array( 'price', 'price.quantity', '' ) ) ); ?>"
								placeholder="<?= $enc->attr( $this->translate( 'admin', 'Minimum quantity' ) ); ?>"
								value="1" />
						</div>
						<div class="col-sm-12 form-text text-muted help-text">
							<?= $enc->html( $this->translate( 'admin', 'Required quantity of articles for block pricing, e.g. one article for $5.00, ten articles for $45.00' ) ); ?>
						</div>
					</div>
				</div>

			</div>

		</div>

		<div class="card-tools-more">
			<div class="btn btn-primary btn-card-more act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
				title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>">
			</div>
		</div>

	</div>

	<?= $this->get( 'priceBody' ); ?>
</div>
I hope you were referring to this code for regular and prototype block.

Thanks!

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

Re: How to add additional fields to a customer

Post by aimeos » 09 Apr 2018, 06:46

Seems that you've used a 2018.x extension for your 2017.10 project. The configuration for 2018.x should be in ./config/ of your extension because this is configured in the "config" section of the manifest.php. In 2017.x extensions it's in ./lib/custom/config/ and if you place your config there, you have to add that directory to your manifest.php file.

Yes, your template is correct.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: How to add additional fields to a customer

Post by mohal_04 » 09 Apr 2018, 07:26

aimeos wrote:Seems that you've used a 2018.x extension for your 2017.10 project. The configuration for 2018.x should be in ./config/ of your extension because this is configured in the "config" section of the manifest.php. In 2017.x extensions it's in ./lib/custom/config/ and if you place your config there, you have to add that directory to your manifest.php file.

Yes, your template is correct.
Hi,

Thanks for the reply!

No, I am using 2017.10 extension and my custom configuration file is in the correct directory. This is the path to configuration file:

C:\wamp\www\myproject\ext\myextension\lib\custom\config\mshop.php

This is the same path that I have in manifest.php of my extension. See below:

./ext/myextension/manifest.php

Code: Select all

return array(
	'name' => 'myextension',
	'depends' => array(
		'aimeos-core',
		'ai-admin-extadm',
		'ai-admin-jqadm',
		'ai-admin-jsonadm',
		'ai-client-html',
		'ai-client-jsonapi',
		'ai-controller-jobs',
		'ai-controller-frontend',
	),
	'include' => array(
		'lib/custom/src',
		'client/html/src',
		'client/jsonapi/src',
		'controller/common/src',
		'controller/frontend/src',
		'controller/extjs/src',
		'controller/jobs/src',
		'admin/jsonadm/src',
		'admin/jqadm/src',
	),
	'i18n' => array(
		'admin' => 'admin/i18n',
		'admin/jsonadm' => 'admin/jsonadm/i18n',
		'controller/common' => 'controller/common/i18n',
		'controller/frontend' => 'controller/frontend/i18n',
		'controller/extjs' => 'controller/extjs/i18n',
		'controller/jobs' => 'controller/jobs/i18n',
		'mshop' => 'lib/custom/i18n',
		'client' => 'client/i18n',
	),
	'config' => array(
		'lib/custom/config',
	),
	'custom' => array(
		'admin/jsonadm/templates' => array(
			'admin/jsonadm/templates',
		),
		'admin/jqadm/templates' => array(
			'admin/jqadm/templates',
		),
		'admin/extjs' => array(
			'admin/extjs/manifest.jsb2',
		),
		'client/html/templates' => array(
			'client/html/templates',
		),
		'client/jsonapi/templates' => array(
			'client/jsonapi/templates',
		),
		'controller/extjs' => array(
			'controller/extjs/src',
		),
		'controller/jobs' => array(
			'controller/jobs/src',
		),
		'controller/jobs/templates' => array(
			'controller/jobs/templates',
			'client/html/templates',
		),
	),
	'setup' => array(
		'lib/custom/setup',
	),
);
The extended Product Manager is being loaded with same configuration file then why extended Price Manager is not loading. There must be something else wrong. Is there any other method of debugging? Which part of code loads configuration files?

Thanks!

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

Re: How to add additional fields to a customer

Post by aimeos » 09 Apr 2018, 07:51

Everything seems to be correct. You can add a debug output in the factory to see if the configuration is missing:
https://github.com/aimeos/aimeos-core/b ... ry.php#L70

You can also check what happens in the config class during lookup:
https://github.com/aimeos/aimeos-core/b ... ay.php#L49

Can you post your ./config/shop.php file as well (remove the DB credentials before)?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: How to add additional fields to a customer

Post by mohal_04 » 09 Apr 2018, 08:05

aimeos wrote:Everything seems to be correct. You can add a debug output in the factory to see if the configuration is missing:
https://github.com/aimeos/aimeos-core/b ... ry.php#L70

You can also check what happens in the config class during lookup:
https://github.com/aimeos/aimeos-core/b ... ay.php#L49

Can you post your ./config/shop.php file as well (remove the DB credentials before)?
Hi,

Here is shop.php file's code...

./config/shop.php

Code: Select all

return [

	'routes' => [
		// 'login' => ['middleware' => ['web']],
		// 'jqadm' => ['prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth']],
		// 'extadm' => ['prefix' => 'admin/{site}/extadm', 'middleware' => ['web', 'auth']],
		// 'jsonadm' => ['prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth']],
		// 'jsonapi' => ['prefix' => 'jsonapi', 'middleware' => ['web', 'api']],
		// 'account' => ['middleware' => ['web', 'auth']],
		// 'default' => ['middleware' => ['web']],
		// 'update' => [],
	],

	'page' => [
		// 'account-index' => [ 'account/profile','account/history','account/favorite','account/watch','basket/mini','catalog/session' ],
		// 'basket-index' => [ 'basket/standard','basket/related' ],
		// 'catalog-count' => [ 'catalog/count' ],
		// 'catalog-detail' => [ 'basket/mini','catalog/stage','catalog/detail','catalog/session' ],
		// 'catalog-list' => [ 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ],
		// 'catalog-stock' => [ 'catalog/stock' ],
		// 'catalog-suggest' => [ 'catalog/suggest' ],
		// 'checkout-confirm' => [ 'checkout/confirm' ],
		// 'checkout-index' => [ 'checkout/standard' ],
		// 'checkout-update' => [ 'checkout/update' ],
	],

	/*
	'resource' => [
		'db' => [
			'adapter' => env('DB_CONNECTION', 'mysql'),
			'host' => env('DB_HOST', 'localhost'),
			'port' => env('DB_PORT', ''),
			'socket' => '',
			'database' => env('DB_DATABASE', 'laravel'),
			'username' => env('DB_USERNAME', 'root'),
			'password' => env('DB_PASSWORD', ''),
			'stmt' => ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8'; SET SESSION sql_mode='ANSI'"],
		],
	],
	*/

	'admin' => [],

	'client' => [
		'html' => [
			'basket' => [
				'cache' => [
					// 'enable' => false, // Disable basket content caching
				],
			],
			'common' => [
				'content' => [
					// 'baseurl' => '/',
				],
				'template' => [
					// 'baseurl' => 'packages/aimeos/shop/themes/elegance',
				],
			],
		],
	],

	'controller' => [
	],

	'i18n' => [
		'en' => [
			'client' => [
				'VAT' => 'Sales Tax'
			]
		]
	],

	'madmin' => [
		'cache' => [
			'manager' => [
				// 'name' => 'None', // Disable caching
			],
		],
		'log' => [
			'manager' => [
				'standard' => [
					// 'loglevel' => 7, // Enable debug logging into madmin_log table
				],
			],
		],
	],

	'mshop' => [
		'price' => [
			'taxflag' => 0
		]
	],


	'command' => [
	],

	'frontend' => [
	],

	'backend' => [
	],

];
Thank you so much for your help!

Post Reply