Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sell Courses can't be activated/installed on 1.11.14 #3693

Closed
Bavarianspirit opened this issue Dec 2, 2020 · 25 comments
Closed

Sell Courses can't be activated/installed on 1.11.14 #3693

Bavarianspirit opened this issue Dec 2, 2020 · 25 comments

Comments

@Bavarianspirit
Copy link

Describe
On a new installation, sell courses Plug-In does not work

To Reproduce
Steps to reproduce the behavior:
take a new installation an try to activate sell courses
the is an error - look the screenshot

tested
/var/www/html/plugin/buycourses/update.php
gives me an error
also by using the install.php
"Es ist ein Fehler aufgetreten. Bitte kontaktieren Sie den System-Administrator."
...translated "There is an error. Please contact your system-admin"

Screenshot 2020-12-02 231051

@lonesomewalker
Copy link

v6.0 - 2020-11-29
====
Added support for purchase instructions e-mail customization (although this 
does not support multiple languages at the moment).
This requires changes to the DB tables:
sql
ALTER TABLE plugin_buycourses_global_config ADD COLUMN info_email_extra TEXT;

@Bavarianspirit
Copy link
Author

Yo,
theres no table fits the sql statement.
The plugin has no chance to modify the database. There occurs an error while enabling the plugin. The database receive no transactions.

@lonesomewalker
Copy link

Confirm this as a bug.

@lonesomewalker
Copy link

First, disable plugin.
Insert this in database for a quick and dirty fix.
https://pastebin.com/kmisW6bh
Then enable plugin.

@AngelFQC
Copy link
Member

AngelFQC commented Dec 3, 2020

Bug confirmed when installing the plugin.

I sent one commit to fix it.

@Coursenligne
Copy link

Hi all,
I also confirm the bug.
As a workaround (as the white page appears right after you select "sell courses"), first of all, enable all the plugin you wish prior to sell courses.
then when you activate sell courses, you get the crash. click on the link "Admin" and follow the link "Empty cache". This will allow the plugin to work, BUT you still get the white page when you awnt to enable/disable any other plugin.
If you want to do so, you then have to untick the sell courses plugin, select/unselect the wanted other plugin, reselect sell courses and do the empty cache :)
So happy to read there is a fix...
Thanks to the developpers team!

@MalkavianBilbao
Copy link

MalkavianBilbao commented Jan 12, 2021

First, disable plugin.
Insert this in database for a quick and dirty fix.
https://pastebin.com/kmisW6bh
Then enable plugin.

It is needed too:
ALTER TABLE plugin_buycourses_global_config ADD COLUMN info_email_extra TEXT;

@DrMickArtisan
Copy link
Contributor

DrMickArtisan commented Mar 23, 2021

I got the fix, if somebdy could add it to source code :
in plugin/buycourses/database.php, line 386 there is a block of code to update the settings table by adding info_email_extra field.
$settingsTable = BuyCoursesPlugin::TABLE_GLOBAL_CONFIG;
$sql = "SHOW COLUMNS FROM $settingsTable WHERE Field = 'info_email_extra'";
$res = Database::query($sql);
if (Database::num_rows($res) === 0) {
$sql = "ALTER TABLE $settingsTable ADD (info_email_extra TEXT NOT NULL)";
$res = Database::query($sql);
if (!$res) {
echo Display::return_message($this->get_lang('ErrorUpdateFieldDB'), 'warning');
}
}

But while installing the plugin, at this point, the corresponding table is not yet created :( .
So fix is simply to move this block of code to end of file ..

@AngelFQC
Copy link
Member

Hi @DrMickArtisan
The fix to this issue was sent in this commit 763ac4d

Please try replicate the fixed code in your Chamilo source code.

@Coursenligne
Copy link

Hi,
Just to let you know, I tried on my Chamilo platform (fresh install 1.11.14 Win10 / Wamp) and I confirm the fix works well!
Many thanks to DrMickArtisan for the fix and to the team for fix integration... :)

@DrMickArtisan
Copy link
Contributor

Ok, works like a charm, thanks to all !

@AngelFQC
Copy link
Member

Thank you for the confirmation

@rleonanaya
Copy link

Hi, I just tried to install de plugin in a XAMP Chamilo v 1.11.14 stable fresh install and it doesn't work.
image

First I tried to enable the plugin and it displays an error.
As this thread stated, I clean up the cache and re-try to install but shows the same error.
Although the plugin shows error on activate it, it permits to enter the configuration page, but all the other pages shows error.
After seen the Apache log, I notice the error shows that some tables are missing. As the thread stated, I run the scripts directly on MySql and Success! The plugin worked.

Hopefully this helps to find the error in XAMP that doesn't run automatically the scripts on the database.:

The error that shows when trying to enabling the plugin:
image
Besides the error, the plugin stated it is enabled:
image

The error that throws when entering the any configuration menu (Courses and prices configurations, payments configurations, sales report)
image
image

The apache log states:
[Sat Apr 03 14:57:51.346649 2021] [php7:notice] [pid 5840:tid 1664] [client 192.168.0.1:62763] An exception occurred while executing 'SHOW COLUMNS FROM plugin_buycourses_global_config WHERE Field = 'info_email_extra'':\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'chamilo_new.plugin_buycourses_global_config' doesn't exist, referer: http://192.168.0.27:8787/chamilo/main/admin/settings.php?category=Plugins&sec_token=64740637c8d163a89dcfe5c887476089

@lonesomewalker
Copy link

How about reading the things above?

@rleonanaya
Copy link

Hi lonesomewalker.

I post the error because it is declared as solved on WAMP, but in XAMP the bug persist.

@lonesomewalker
Copy link

Have you tried it?

@Bavarianspirit
Copy link
Author

Hi lonesomewalker,

i tried the plugin and it works beautiful.
It seems that there is a configuration issue that makes this plugin partially useless.
I opened a new case:
#3840

@rleonanaya
Copy link

Have you tried it?

Sorry lonesomewalker for not clarifying in my last post. Before updating the database manually it worked!
I just documented the case where in XAMP enabling the plugin does not execute the scripts.

If someone need some info about my configuration, I can share it.

@angelart07
Copy link

angelart07 commented Apr 21, 2021

lo solucioné ingresando a PHPMYADMIN del CPANEL, ubiqué la base de datos y agregué la siguientes sentencias SQL:

https://pastebin.com/kmisW6bh

También es necesario agregar la siguiente sentencia SQL:

ALTER TABLE plugin_buycourses_global_config ADD COLUMN info_email_extra TEXT;

@Leonardolms
Copy link

Leonardolms commented Mar 14, 2022

And Table plugin_buycourses_coupon doesn't exist

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxxxx.plugin_buycourses_coupon' doesn't exist
[14-Mar-2022 22:02:07 UTC] An exception occurred while executing 'SELECT * FROM plugin_buycourses_coupon WHERE active = '1' ORDER BY id desc ':

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'u566206645_gFSin.plugin_buycourses_coupon' doesn't exist

@DrMickArtisan @lonesomewalker @angelart07 @AngelFQC

@AngelFQC
Copy link
Member

Hi @Leonardolms
The coupons feature was added here 4d8435a
Maybe you need update the database as indicated here https://github.com/chamilo/chamilo-lms/blob/1.11.x/plugin/buycourses/CHANGELOG.md#v70---2021-08-12

@Leonardolms
Copy link

Leonardolms commented Mar 15, 2022

Hi @AngelFQC

I edited database.php line 450 changed TINYINT to BOOLEAN anda update BD and now it worked correctly.

It seems that the fix reported in the link below is not reflecting in 1.11.16!

#4098

Correctly is TINYINT or BOOLEAN in database.php?

Sincerely.

@AngelFQC
Copy link
Member

Hi @AngelFQC

I edited database.php line 450 changed TINYINT to BOOLEAN anda update BD and now it worked correctly.

It seems that the fix reported in the link below is not reflecting in 1.11.16!

#4098

Correctly is TINYINT or BOOLEAN in database.php?

Yes it was fixed in 1.11.x branch here e87dfc5

Sincerely.

@astrorawson
Copy link

astrorawson commented Jun 16, 2022

Hi,
It seems that the fix is not included in 1.11.16.

I made a Chamilo 1.11.16 fresh installation and enabled the "buy courses" plugin.
Once enabled, clicking on the "Configure" button of the plugin shows the configuration screen, with the different options without any issues.

But trying to select any option on the plugin main screen (buy courses, courses and prices configuration, coupons configuration, payments configuration, sales report), it shows an error and doesn't work.

Looking at the home/plugin/buycourses/src/error.log file, it shows the following error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxxx.plugin_buycourses_currency' doesn't exist
[16-Jun-2022 13:17:40 America/Argentina/Buenos_Aires] An exception occurred while executing 'SELECT * FROM plugin_buycourses_currency

It seems that the tables and database stuff needed for the plugin to work is not automatically being created/included in this distribution. It is necessary to manually create those.

So I had to go to cPanel, open PHPMyAdmin, select the Chamilo database and run the SQL sentences posted by angelart07

https://pastebin.com/kmisW6bh

También es necesario agregar la siguiente sentencia SQL:

ALTER TABLE plugin_buycourses_global_config ADD COLUMN info_email_extra TEXT;

After that, I realized that the coupons option was still not working, so I had to run the update.php included in the distribution for it to work (simply access the following URL from my browser: https://website.domain/plugin/buycourses/update.php)

After doing all this, it is working fine.

Note that if you run the update.php before running the SQL sentences on PHPMyAdmin, it will fail throwing the same kind of error.

So the sequence for the plugin to work is,

  1. Enable the Plugin
  2. Configure it
  3. Go to cPanel, open PHPMyAdmin and run the SQL sentences on the Chamilo Database
  4. Go to https://website.domain/plugin/buycourses/update.php

I'm simply posting this to help others in case they have the same issue.

Please be sure to incorporate all this stuff in the next Chamilo version.

Thanks and best regards.

@sistemasExA
Copy link

Good evening, I tried all that with version 1.11.16 and it won't let me use the update.php file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests