Re: Extend Stock to Save a new Value
Posted: 06 Apr 2018, 14:12
Hi all and hi Administrator,
after i installed the newest aimeos 18.1.1 typo 3 extension i got a problem with my template.
I see you use vue.js now, so i edited my template.
I changed the template files name from default to standard and I added the new key and copied the form line but i cant see the data ordertime in in data items stockdata. I just get a blank form and this error message, maybe someone knows some help that would be awesome.
Path: /typo3conf/ext/mhaimeos/Resources/Private/Extensions/mhaimeos/admin/jqadm/templates/product/item-stock-standard.php
Error message:
Do you know what im doing wrong?
Thanks in advance
after i installed the newest aimeos 18.1.1 typo 3 extension i got a problem with my template.
I see you use vue.js now, so i edited my template.
I changed the template files name from default to standard and I added the new key and copied the form line but i cant see the data ordertime in in data items stockdata. I just get a blank form and this error message, maybe someone knows some help that would be awesome.
Path: /typo3conf/ext/mhaimeos/Resources/Private/Extensions/mhaimeos/admin/jqadm/templates/product/item-stock-standard.php
Code: Select all
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Aimeos (aimeos.org), 2015-2017
*/
$enc = $this->encoder();
$stockTypes = $this->get( 'stockTypes', [] );
//$keys = ['stock.id', 'stock.siteid', 'stock.typeid', 'stock.stocklevel', 'stock.dateback'];
/** New Stock Var Ordertime - AZ **/
$keys = ['stock.id', 'stock.siteid', 'stock.typeid', 'stock.stocklevel', 'stock.dateback', 'stock.ordertime'];
/** New Stock Var Ordertime - AZ **/
?>
<div id="stock" class="item-stock content-block tab-pane fade" role="tabpanel" aria-labelledby="stock">
<table class="stock-list table table-default"
data-items="<?= $enc->attr( json_encode( $this->get( 'stockData', [] ) ) ); ?>"
data-keys="<?= $enc->attr( json_encode( $keys ) ) ?>"
data-prefix="stock."
data-siteid="<?= $this->site()->siteid() ?>"
data-numtypes="<?= count( $stockTypes ) ?>" >
<thead>
<tr>
<?php if( count( $stockTypes ) > 1 ) : ?>
<th class="stock-type">
<span class="help"><?= $enc->html( $this->translate( 'admin', 'Type' ) ); ?></span>
<div class="form-text text-muted help-text">
<?= $enc->html( $this->translate( 'admin', 'Warehouse or local store if your articles are available at several locations' ) ); ?>
</div>
</th>
<?php endif; ?>
<th class="stock-stocklevel">
<span class="help"><?= $enc->html( $this->translate( 'admin', 'Stock level' ) ); ?></span>
<div class="form-text text-muted help-text">
<?= $enc->html( $this->translate( 'admin', 'Number of articles currently in stock, leave empty for an unlimited quantity' ) ); ?>
</div>
</th>
<th class="stock-databack">
<span class="help"><?= $enc->html( $this->translate( 'admin', 'Back in stock' ) ); ?></span>
<div class="form-text text-muted help-text">
<?= $enc->html( $this->translate( 'admin', 'Shown if the article reached a stock level of zero' ) ); ?>
</div>
</th>
<th class="stock-ordertime ">
<span class="help"><?= $enc->html( $this->translate( 'admin', 'Back in stock' ) ); ?></span>
<div class="form-text text-muted help-text">
<?= $enc->html( $this->translate( 'admin', 'Shown if the article reached a stock level of zero' ) ); ?>
</div>
</th>
<th class="actions">
<div v-if="(items['stock.id'] || []).length < numtypes" class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>"
v-on:click="addItem()">
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(id, idx) in items['stock.id']" v-bind:key="idx" class="stock-row">
<?php if( count( $stockTypes ) > 1 ) : ?>
<td class="stock-type mandatory">
<select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>"
name="<?= $enc->attr( $this->formparam( array( 'stock', 'stock.typeid', '' ) ) ); ?>"
v-bind:readonly="checkSite('stock.siteid', idx)"
v-model="items['stock.typeid'][idx]" >
<option value="" disable>
<?= $enc->html( $this->translate( 'admin', 'Please select' ) ); ?>
</option>
<?php foreach( $stockTypes as $typeId => $typeItem ) : ?>
<option value="<?= $enc->attr( $typeId ); ?>" v-bind:selected="items['stock.typeid'][idx] == '<?= $enc->attr( $typeId ) ?>'">
<?= $enc->html( $typeItem->getLabel() ) ?>
</option>
<?php endforeach; ?>
</select>
</td>
<?php else : ?>
<input class="item-typeid" type="hidden"
name="<?= $enc->attr( $this->formparam( array( 'stock', 'stock.typeid', '' ) ) ); ?>"
value="<?= $enc->attr( key( $stockTypes ) ); ?>" />
<?php endif; ?>
<td class="stock-stocklevel optional">
<input class="form-control item-stocklevel" type="number" step="1" min="0" tabindex="<?= $this->get( 'tabindex' ); ?>"
name="<?= $enc->attr( $this->formparam( array( 'stock', 'stock.stocklevel', '' ) ) ); ?>"
v-bind:readonly="checkSite('stock.siteid', idx)"
v-model="items['stock.stocklevel'][idx]" />
</td>
<td class="stock-databack optional">
<input class="form-control item-dateback" type="datetime-local" tabindex="<?= $this->get( 'tabindex' ); ?>"
name="<?= $enc->attr( $this->formparam( array( 'stock', 'stock.dateback', '' ) ) ); ?>"
placeholder="<?= $enc->attr( $this->translate( 'admin', 'YYYY-MM-DD hh:mm:ss (optional)' ) ); ?>"
v-bind:readonly="checkSite('stock.siteid', idx)"
v-model="items['stock.dateback'][idx]" />
</td>
<td class="stock-ordertime optional">
<input class="form-control item-ordertime" type="string" tabindex="<?= $this->get( 'tabindex' ); ?>"
name="<?= $enc->attr( $this->formparam( array( 'stock', 'stock.ordertime', '' ) ) ); ?>"
placeholder="<?= $enc->attr( $this->translate( 'admin', 'Order Time' ) ); ?>"
v-bind:readonly="checkSite('stock.siteid', idx)"
v-model="items['stock.ordertime'][idx]" />
</td>
<td class="actions">
<input class="item-id" type="hidden" v-model="items['stock.id'][idx]"
name="<?= $enc->attr( $this->formparam( array( 'stock', 'stock.id', '' ) ) ); ?>" />
<div v-if="!checkSite('stock.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>"
title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>"
v-on:click.stop="removeItem(idx)">
</div>
</td>
</tr>
</tbody>
</table>
<?= $this->get( 'stockBody' ); ?>
</div>
Code: Select all
VM4115 vue.min.js:6 TypeError: Cannot read property '0' of undefined
at eval (eval at wi (VM4067 vue.min.js:6), <anonymous>:2:2534)
at Ot.et [as _l] (VM4067 vue.min.js:6)
at Ot.eval (eval at wi (VM4067 vue.min.js:6), <anonymous>:2:949)
at Ot.e._render (VM4067 vue.min.js:6)
at Ot.r (VM4067 vue.min.js:6)
at Uo.get (VM4067 vue.min.js:6)
at new Uo (VM4067 vue.min.js:6)
at Se (VM4067 vue.min.js:6)
at Ot.$mount (VM4067 vue.min.js:6)
at Ot.$mount (VM4067 vue.min.js:6)
Thanks in advance