Category : octobercms

I want to make an input in the admin panel with which you can increase / decrease prices in several tables in db by %. At the moment, I did it through a filter { return [ new TwigSimpleFilter(‘price_kiev’, [$this, ‘formatPriceKiev’]) ]; } public function getPriceEditKiev() { $result = DB::table(‘another_pricelist_edit’)->select(‘price_edit_kiev’)->where(‘id’, 1)->first(); return $result->price_edit_kiev; } public ..

Read more

here is a function I have for creating a new Contact. It works fine and as expected. What I would like to know is if there is a better way or best practice to simplify and improve the code. I am simply looking to improve my skills and build more efficient functions. public function onSave() ..

Read more

Morning all, I am trying to create a button that will copy the organisation address and populate the organisation billing address fields. I have no idea where to start. The fields in question are: // I want to copy these values $organisation->email = Input::get(’email’); $organisation->line_1 = Input::get(‘line_1’); $organisation->line_2 = Input::get(‘line_2’); $organisation->line_3 = Input::get(‘line_3’); $organisation->city = ..

Read more

I am attempting to create a function that will duplicate an existing record using the laravel ‘replicate’ method. Here is what I what but it’s not working as expected. updateContact.php use CmsClassesComponentBase; use Input; use Validator; use Redirect; use ItinifyItinifyModelsContact; use ItinifyItinifyModelsOrganisation; use CarbonCarbon; public function replicateRecord() { $contact = Contact::find($this->param(‘id’)); $newContact = $contact->replicate(); $newContact->created_at ..

Read more

I have 3 models. Quote Status Event 1 Quote belongs to 1 Status and 1 Event. However Status and Event can have many Quote. How do i set this relationship up? Here is an example: I create a new quote and select ‘Active’ as the Status and the Event as ‘Golf’ Sourc..

Read more

In my OctoberCMS application, I want to change a repeater value depend on another field value change. But it’s not working in the filterFields model method or formExtendRefreshFields controller method. I am trying like bellow, public function filterFields($fields, $context = null) { $fields->item_details->value = [my prepared array value]; } all other property like label, comments ..

Read more

It was working fine before but now my assets are not loading anymore. I am working locally with Laragon. These are the errors I get, but if I follow the paths, the files are exisiting. Thanx in advance, Sander [Sat Jul 10 13:52:31 2021] 127.0.0.1:64167 [404]: /themes/dodojayaraditya-dodo-jaya-raditya-one-tailwind/assets/css/stailwind.css – No such file or directory [Sat Jul ..

Read more

When creating a new record for my plugin with file upload it returns this error: "array_flip() expects parameter 1 to be array, null given" on line 86 of /var/www/html/october-cms/solas/vendor/october/rain/src/Database/Behaviors/Purgeable.php I already included the field to the model in public $attachOne and removed the field on the database. How can I save files and images. Source: ..

Read more

I must update my currency rate and I have this in my Plugin.php: { $schedule->call(function () { $url = "https://cbu.uz/ru/services/open_data/rates/json/"; $json = json_decode(file_get_contents($url), true); file_put_contents("currency.json", json_encode($json[0][‘G4’])); })->everyMinute(); } I ran my cron job in cpanel /usr/local/bin/ea-php72 /var/www/u1041398/public_html/agroparts.uz/artisan schedule:run >> /dev/null 2>&1 Path is correct I checked php version it is correct also. My cron codes ..

Read more

I have a problem displaying the default.htm file of the component I created. I can drag and drop the component into a page or partial but will not display anything. What I currently have: Component called {% component ‘researchResources’ %} it is already listed in the components menu Problem: When I drag and drop the ..

Read more

Moved website on october cms to another webspace . Getting error 504 Gateway Time-out Log [2021-04-30 10:20:18] development.WARNING: Failed to create size "11812" for image "/var/www/www-root/data/www/website.kz/web/storage/app/uploads/public/5fa/d00/d5a/5fad00d5ada98010227148.png" [2021-04-30 10:20:18] development.WARNING: Failed to create size "400" for image "/var/www/www-root/data/www/website.kz/web/storage/app/uploads/public/5f9/3f0/775/5f93f077562b5764930583.jpg" [2021-04-30 10:20:18] development.WARNING: Failed to create size "768" for image "/var/www/www-root/data/www/website.kz/web/storage/app/uploads/public/5f9/3f0/775/5f93f077562b5764930583.jpg" [2021-04-30 10:20:18] development.WARNING: Failed to create size ..

Read more

I moved project in October cms to another server . I just copy all files to new webspace and change db data. Got this error file_put_contents(/var/www/www-root/data/www/website.kz/web/storage/framework/cache/11/de/11de31e1eabb2682cf62ee9c9ccb0630f1019006): failed to open stream: No such file or directory /var/www/www-root/data/www/website.kz/web/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 122 I made php artisan cache:clear but it not works . Also getting The bootstrap/cache directory must be ..

Read more

OctoberCMS (472), Laravel: I would like to the "visitors" [integer] increment by one after every reload. function onStart(){ ModelName::where(‘slug’, ‘=’, $this->param(‘slug’))->increment(‘visitors’); } After that I reload the page, visitors increment by two, not with one. Why? I can’t understand. When I try increment(‘visitors’, 2) – incremented by four. How and why? Sourc..

Read more

I must create new table in octobercms project and I followed documentation and added new migration file inside plugin update file I have create_currency_rates_table.php file and it has this codes <?php namespace RainLabUserUpdates; use Schema; use OctoberRainDatabaseUpdatesMigration; class CreateCurrencyRateTable extends Migration { public function up() { Schema::create(‘currency_rates’, function($table) { $table->engine = ‘InnoDB’; $table->increments(‘id’); $table->string(‘currency’); }); ..

Read more