Kurre Posted July 1, 2019 Posted July 1, 2019 I found a Ask a proct question https://apps.oscommerce.com/WjgMM&ask-a-product-question-1-0-for-2-3 but it is for 2.3.4 BootStrap EDGE Is there a version for the 2.3.4 CE bootstrap version too ? Or do anyone know how to change to work with it ? Or is there a mod similar to this ?
YePix Posted July 1, 2019 Posted July 1, 2019 the installation takes about 5 minutes. in the manual is how it is done. Write which oscommerce version you have installed and the file "ask_a_question.php" here
Kurre Posted July 2, 2019 Author Posted July 2, 2019 I think it is called Frozen version of the 2.3.4.1 CE Bootstrap The instructions says 3.) Open /catalog/product_info.php If you have not made any prior changes to this file you can simply replace it with the included version, otherwise: FIND near the bottom of the file: <div class="buttonSet row"> <div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'fa fa-commenting', tep_href_link('product_reviews.php', tep_get_all_get_params())); ?></div> <div class="col-xs-6 text-right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); ?></div> </div> REPLACE WITH: <div class="buttonSet row"> <div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'fa fa-commenting', tep_href_link('product_reviews.php', tep_get_all_get_params())); ?></div> <?php if (tep_session_is_registered('customer_id') || (ALLOW_ASK_A_QUESTION == 'true')) { ?> <div class="col-xs-6"><?php echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id'])); ?></div> <?php } ?> </div> <div class="col-xs-6 text-right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); ?></div> The code is not there, if I look in the file includes/modules/content/product_info/templates/tpl_cm_pi_buy_button.php the code is <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </div> I guess that code shoud be the code I need to change ?
YePix Posted July 2, 2019 Posted July 2, 2019 this code <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </div> change with <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <span class="col-xs-6"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </span> <span class="col-xs-6"> <?php if (tep_session_is_registered('customer_id') || (ALLOW_ASK_A_QUESTION == 'true')){echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id']));}?> </span> </div>
kgtee Posted July 3, 2019 Posted July 3, 2019 @Kurre If you have the REVIEW module enabled, you may modify the template "tpl_cm_pi_review_button.php" to include the "Ask-a-Question" button. Quote <div class="col-xs-<?php echo $content_width; ?> cm-pi-review-button"> <?php echo tep_draw_button(MODULE_CONTENT_PI_REVIEW_BUTTON_TEXT, 'fas fa-comment-alt', tep_href_link('product_reviews.php', tep_get_all_get_params())); echo ' '; echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id'])); ?> </div> Or, if you do not use the review button, you may just comment the review button statement out with "//".
puddlec Posted July 3, 2019 Posted July 3, 2019 13 hours ago, YePix said: this code <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </div> change with <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <span class="col-xs-6"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </span> <span class="col-xs-6"> <?php if (tep_session_is_registered('customer_id') || (ALLOW_ASK_A_QUESTION == 'true')){echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id']));}?> </span> </div> a better idea would be to create a new module to put the ask a question button instead of sticking it in an existing module, first of all you don't need to turn on a complete different module to use it, and you can have more control over where the button is placed Phoenix support now at https://phoenixcart.org/forum/ App created for phoenixTinyMCE editor for admin
YePix Posted July 3, 2019 Posted July 3, 2019 includes/modules/content/product_info/ <?php class cm_pi_ask_a_question { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_PI_ASK_A_QUESTION_TITLE; $this->description = MODULE_CONTENT_PI_ASK_A_QUESTION_DESCRIPTION; $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>'; if ( defined('MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS') ) { $this->sort_order = MODULE_CONTENT_PI_ASK_A_QUESTION_SORT_ORDER; $this->enabled = (MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS == 'True'); } } function execute() { global $oscTemplate, $product_info; $content_width = (int)MODULE_CONTENT_PI_ASK_A_QUESTION_CONTENT_WIDTH; ob_start(); include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__)); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Ask a question Button', 'MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS', 'True', 'Should this module be shown on the product info page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Guest to ask a question', 'MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION', 'True', 'Allow a Guest to ask a product question without login? ', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PI_ASK_A_QUESTION_CONTENT_WIDTH', '6', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PI_ASK_A_QUESTION_SORT_ORDER', '90', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS', 'MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION', 'MODULE_CONTENT_PI_ASK_A_QUESTION_CONTENT_WIDTH', 'MODULE_CONTENT_PI_ASK_A_QUESTION_SORT_ORDER'); } } ?> ***************************** includes/modules/content/product_info/templates/ <div class="col-sm-<?php echo $content_width; ?> cm_pi_ask_a_question_button"> <?php if (tep_session_is_registered('customer_id') || (MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION == 'True')){echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id']));}?> </div>
Kurre Posted July 3, 2019 Author Posted July 3, 2019 14 hours ago, YePix said: this code <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </div> change with <div class="col-xs-<?php echo $content_width; ?> text-right cm-pi-buy-button"> <span class="col-xs-6"> <?php echo tep_draw_button(MODULE_CONTENT_PI_BUY_BUTTON_TEXT, 'fa fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-product-info btn-buy'); echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']); ?> </span> <span class="col-xs-6"> <?php if (tep_session_is_registered('customer_id') || (ALLOW_ASK_A_QUESTION == 'true')){echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id']));}?> </span> </div> Thanks for trying but it did not work, the button did not show up.
YePix Posted July 3, 2019 Posted July 3, 2019 includes/languages/english/modules/content/product_info/ <?php const MODULE_CONTENT_PI_ASK_A_QUESTION_TITLE = 'Ask a question Button'; const MODULE_CONTENT_PI_ASK_A_QUESTION_DESCRIPTION = 'Shows the ask a question Button on the product_info Page.'; const MODULE_CONTENT_PI_ASK_A_QUESTION_BUTTON_TEXT = 'Ask a question'; ?>
Kurre Posted July 3, 2019 Author Posted July 3, 2019 6 hours ago, kgtee said: @Kurre If you have the REVIEW module enabled, you may modify the template "tpl_cm_pi_review_button.php" to include the "Ask-a-Question" button. Or, if you do not use the review button, you may just comment the review button statement out with "//". The button showed up and the form but I did not recive any mail..
YePix Posted July 3, 2019 Posted July 3, 2019 I posted it as a separate module above. If there are problems with the email, check ask_a_question.php in catalog directory
Kurre Posted July 3, 2019 Author Posted July 3, 2019 10 minutes ago, YePix said: includes/modules/content/product_info/ <?php class cm_pi_ask_a_question { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_PI_ASK_A_QUESTION_TITLE; $this->description = MODULE_CONTENT_PI_ASK_A_QUESTION_DESCRIPTION; $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>'; if ( defined('MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS') ) { $this->sort_order = MODULE_CONTENT_PI_ASK_A_QUESTION_SORT_ORDER; $this->enabled = (MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS == 'True'); } } function execute() { global $oscTemplate, $product_info; $content_width = (int)MODULE_CONTENT_PI_ASK_A_QUESTION_CONTENT_WIDTH; ob_start(); include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__)); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Ask a question Button', 'MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS', 'True', 'Should this module be shown on the product info page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Guest to ask a question', 'MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION', 'True', 'Allow a Guest to ask a product question without login? ', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PI_ASK_A_QUESTION_CONTENT_WIDTH', '6', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PI_ASK_A_QUESTION_SORT_ORDER', '90', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_PI_ASK_A_QUESTION_STATUS', 'MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION', 'MODULE_CONTENT_PI_ASK_A_QUESTION_CONTENT_WIDTH', 'MODULE_CONTENT_PI_ASK_A_QUESTION_SORT_ORDER'); } } ?> ***************************** includes/modules/content/product_info/templates/ <div class="col-sm-<?php echo $content_width; ?> cm_pi_ask_a_question_button"> <?php if (tep_session_is_registered('customer_id') || (MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION == 'True')){echo tep_draw_button(TEXT_ASK_QUESTION, 'fa fa-question', tep_href_link('ask_a_question.php', 'products_id='.$product_info['products_id']));}?> </div> I will try this!
Kurre Posted July 3, 2019 Author Posted July 3, 2019 @YePix Yes it worked ! Many thanks for your help, and I recived the emails to. It was the forward email in my mailbox that stopped them. This gave me the choise Allow Guest to ask a question too wich I nedeed too! Thanks to the others too for helping!
Kurre Posted July 3, 2019 Author Posted July 3, 2019 @YePix Saw now that Allow Guest to ask a question, any idea why not ? Nothing happens but a reload of the page.
YePix Posted July 3, 2019 Posted July 3, 2019 ask_a_question.php find: if (!tep_session_is_registered('customer_id') && (ALLOW_ASK_A_QUESTION != 'true')) { change with: if (!tep_session_is_registered('customer_id') && (MODULE_CONTENT_PI_ALLOW_ASK_A_QUESTION != 'True')) {
Recommended Posts
Archived
This topic is now archived and is closed to further replies.