Skip to content

Commit 9375146

Browse files
initial calendar development
1 parent e534af1 commit 9375146

File tree

24 files changed

+644
-166
lines changed

24 files changed

+644
-166
lines changed

app/base/blocks/LinkToCart.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ public function renderHTML(?BasePage $current_page = null, array $data = []): st
8989

9090
$numItems = count($this->getCart($current_page)?->getItems() ?? []);
9191

92-
$targetHref = $this->getWebRouter()->getUrl("frontend.commerce.cart");
92+
$targetHref = $this->getWebRouter()->getUrl("frontend.commerce.cart.withlang", [
93+
'lang' => $current_page?->getCurrentLocale(),
94+
]);
9395
$countbadge = '<span class="badge badge-secondary position-absolute" style="bottom: -5px; left: -5px;">'.$numItems.'</span>';
9496

9597

app/base/commands/Generate/Model.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,14 @@ protected function askColumnInfo(): ?array
210210
protected function getModelFileContents($className): string
211211
{
212212
$comment = '';
213+
$comment .= " * @method int getId()\n";
213214
foreach ($this->columns as $name => $column_info) {
214215
$comment .= " * @method " . $column_info['php_type'] . " get" . $this->getUtils()->snakeCaseToPascalCase($name) . "()\n";
215216
}
216217
$comment .= " * @method \\DateTime getCreatedAt()\n";
217218
$comment .= " * @method \\DateTime getUpdatedAt()\n";
218219

220+
$comment .= " * @method self setId(int \$id)\n";
219221
foreach ($this->columns as $name => $column_info) {
220222
$comment .= " * @method self set" . $this->getUtils()->snakeCaseToPascalCase($name) . "(" . $column_info['php_type'] . " \${$name})\n";
221223
}

app/base/commands/Generate/Product.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,14 @@ protected function askColumnInfo(): ?array
370370
protected function getModelFileContents($className): string
371371
{
372372
$comment = '';
373+
$comment .= " * @method int getId()\n";
373374
foreach ($this->columns as $name => $column_info) {
374375
$comment .= " * @method " . $column_info['php_type'] . " get" . $this->getUtils()->snakeCaseToPascalCase($name) . "()\n";
375376
}
376377
$comment .= " * @method \\DateTime getCreatedAt()\n";
377378
$comment .= " * @method \\DateTime getUpdatedAt()\n";
378379

380+
$comment .= " * @method self setId(int \$id)\n";
379381
foreach ($this->columns as $name => $column_info) {
380382
$comment .= " * @method self set" . $this->getUtils()->snakeCaseToPascalCase($name) . "(" . $column_info['php_type'] . " \${$name})\n";
381383
}

app/base/controllers/Admin/Commerce/Dashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function collectData(DateTime $to, ?DateTime $from = null): array
152152
? ($product->getSku() ?: $product->getName())
153153
: $product->getName();
154154
$stock = ($product instanceof PhysicalProductInterface)
155-
? $product->getProductStock()?->getCurrentQuantity()
155+
? ($product->getProductStock()?->getCurrentQuantity() ?? 0)
156156
: $this->getUtils()->translate('unlimited', locale: $this->getCurrentLocale());
157157
} catch (\Exception $e) {
158158
$label = 'n/a';

app/base/controllers/Admin/Commerce/GiftCards.php

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ public function getFormDefinition(FAPI\Form $form, array &$form_state): FAPI\For
8989

9090
switch ($type) {
9191
case 'edit':
92-
$this->addActionLink(
93-
'media-btn',
94-
'media-btn',
95-
$this->getHtmlRenderer()->getIcon('image') . ' ' . $this->getUtils()->translate('Media', locale: $this->getCurrentLocale()),
96-
$this->getUrl('crud.app.site.controllers.admin.json.downloadablemedia', ['id' => $this->getRequest()->query->get('product_id')]) . '?product_id=' . $this->getRequest()->query->get('product_id') . '&action=new',
97-
'btn btn-sm btn-light inToolSidePanel'
98-
);
99-
10092
case 'new':
10193

10294
$product_title = $product_content = $product_media = '';
@@ -165,24 +157,6 @@ public function getFormDefinition(FAPI\Form $form, array &$form_state): FAPI\For
165157
case 'delete':
166158
$this->fillConfirmationForm('Do you confirm the deletion of the selected element?', $form);
167159
break;
168-
169-
case 'media_deassoc':
170-
$media = $this->containerCall([Media::class, 'load'], ['id' => $this->getRequest()->query->get('media_id')]);
171-
$form->addField('product_id', [
172-
'type' => 'hidden',
173-
'default_value' => $product->id,
174-
])->addField('media_id', [
175-
'type' => 'hidden',
176-
'default_value' => $media->id,
177-
])->addField('confirm', [
178-
'type' => 'markup',
179-
'value' => 'Do you confirm the disassociation of the "' . $product->title . '" product from the media ID: ' . $media->id . '?',
180-
'suffix' => '<br /><br />',
181-
])->addMarkup('<a class="btn btn-danger btn-sm" href="' . $this->getUrl('crud.app.site.controllers.admin.json.mediadownloadableproducts', ['id' => $media->id]) . '?media_id=' . $media->id . '&action=downloadable_product_deassoc">Cancel</a>');
182-
183-
$this->addSubmitButton($form, true);
184-
break;
185-
186160
}
187161

188162
return $form;
@@ -235,27 +209,22 @@ public function formSubmitted(FAPI\Form $form, &$form_state): mixed
235209
$product->setWebsiteId($values['frontend']['website_id']);
236210
$product->setMediaId($values['media_id']);
237211
$product->setPrice((float)$values['price']);
212+
$product->setCredit((float)$values['price']);
238213
$product->setTaxClassId($values['tax_class_id']);
239214

240215
$this->setAdminActionLogData($product->getChangedData());
241216

242217
$product->persist();
243218

244-
$this->addSuccessFlashMessage($this->getUtils()->translate("Product Saved."));
219+
$this->addSuccessFlashMessage($this->getUtils()->translate("Giftcard Saved."));
245220
break;
246221
case 'delete':
247222
$product->delete();
248223

249-
$this->setAdminActionLogData('Deleted product ' . $product->getId());
224+
$this->setAdminActionLogData('Deleted giftcard ' . $product->getId());
250225

251-
$this->addInfoFlashMessage($this->getUtils()->translate("Product Deleted."));
226+
$this->addInfoFlashMessage($this->getUtils()->translate("Giftcard Deleted."));
252227

253-
break;
254-
case 'media_deassoc':
255-
if ($values['media_id']) {
256-
$media = $this->containerCall([Media::class, 'load'], ['id' => $values['media_id']]);
257-
$product->removeMedia($media);
258-
}
259228
break;
260229
}
261230

app/base/controllers/Frontend/Commerce/Cart.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
class Cart extends FormPageWithLang
2727
{
2828
use CommercePageTrait;
29-
29+
30+
/**
31+
* @var string page title
32+
*/
33+
protected ?string $page_title = 'Cart';
34+
3035
public function __construct(
3136
protected ContainerInterface $container,
3237
?Request $request = null,
@@ -71,19 +76,6 @@ public static function getRouteVerbs(): array
7176
return ['GET', 'POST'];
7277
}
7378

74-
/**
75-
* {@inheritdoc}
76-
*
77-
* @return string
78-
* @throws BasicException
79-
* @throws DependencyException
80-
* @throws NotFoundException
81-
*/
82-
public function getRouteName(): string
83-
{
84-
return $this->getUtils()->translate('Cart', locale: $this->getCurrentLocale());
85-
}
86-
8779
/**
8880
* @inheritDoc
8981
*/

app/base/controllers/Frontend/Commerce/Checkout/Billing.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class Billing extends FormPageWithLang
2323
{
2424
use CommercePageTrait;
2525

26+
/**
27+
* @var string page title
28+
*/
29+
protected ?string $page_title = 'Billing Address';
30+
2631
/**
2732
* @inheritDoc
2833
*/
@@ -49,19 +54,6 @@ public function getTemplateName(): string
4954
return 'commerce/billing';
5055
}
5156

52-
/**
53-
* {@inheritdoc}
54-
*
55-
* @return string
56-
* @throws BasicException
57-
* @throws DependencyException
58-
* @throws NotFoundException
59-
*/
60-
public function getRouteName(): string
61-
{
62-
return $this->getUtils()->translate('Billing Address', locale: $this->getCurrentLocale());
63-
}
64-
6557
/**
6658
* @inheritDoc
6759
*/

app/base/controllers/Frontend/Commerce/Checkout/Ko.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class Ko extends FrontendPageWithLang
2323
{
2424
use CommercePageTrait;
2525

26+
/**
27+
* @var string page title
28+
*/
29+
protected ?string $page_title = 'There was a little problem processing your order';
30+
2631
/**
2732
* @inheritDoc
2833
*/
@@ -41,19 +46,6 @@ public function canBeFPC(): bool
4146
return false;
4247
}
4348

44-
/**
45-
* {@inheritdoc}
46-
*
47-
* @return string
48-
* @throws BasicException
49-
* @throws DependencyException
50-
* @throws NotFoundException
51-
*/
52-
public function getRouteName(): string
53-
{
54-
return $this->getUtils()->translate('There was a little problem processing your Order', locale: $this->getCurrentLocale());
55-
}
56-
5749
/**
5850
* @inheritDoc
5951
*/

app/base/controllers/Frontend/Commerce/Checkout/Payment.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class Payment extends FormPageWithLang
2828
{
2929
use CommercePageTrait;
3030

31+
/**
32+
* @var string page title
33+
*/
34+
protected ?string $page_title = 'Payment';
35+
3136
/**
3237
* @inheritDoc
3338
*/
@@ -54,19 +59,6 @@ public function getTemplateName(): string
5459
return 'commerce/payment';
5560
}
5661

57-
/**
58-
* {@inheritdoc}
59-
*
60-
* @return string
61-
* @throws BasicException
62-
* @throws DependencyException
63-
* @throws NotFoundException
64-
*/
65-
public function getRouteName(): string
66-
{
67-
return $this->getUtils()->translate('Payment', locale: $this->getCurrentLocale());
68-
}
69-
7062
/**
7163
* @inheritDoc
7264
*/

app/base/controllers/Frontend/Commerce/Checkout/Shipping.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class Shipping extends FormPageWithLang
2626
{
2727
use CommercePageTrait;
2828

29+
/**
30+
* @var string page title
31+
*/
32+
protected ?string $page_title = 'Shipping Address';
33+
2934
/**
3035
* @inheritDoc
3136
*/
@@ -52,19 +57,6 @@ public function getTemplateName(): string
5257
return 'commerce/shipping';
5358
}
5459

55-
/**
56-
* {@inheritdoc}
57-
*
58-
* @return string
59-
* @throws BasicException
60-
* @throws DependencyException
61-
* @throws NotFoundException
62-
*/
63-
public function getRouteName(): string
64-
{
65-
return $this->getUtils()->translate('Shipping Address', locale: $this->getCurrentLocale());
66-
}
67-
6860
/**
6961
* @inheritDoc
7062
*/

0 commit comments

Comments
 (0)