Osclass Support Forums
Osclass theme support => Beta Osclass Theme => Topic started by: kriskoyk on October 05, 2022, 11:45:50 PM
-
Suggested fix: Make it possible to display the attached file in the publisher contact form. The beta theme is missing this feature while it is checked to show.
-
@kriskoyk
Disable ajax form submission
-
If you are referring to this box in the photo, turning it on or off has no effect.
-
Yes, if you have it enabled, submission via ajax cannot work.
-
As I wrote, and disabled does not work
-
Check your first post, you have disabled attachments in contact form.
-
Sending attachments to the advertiser is aware but the attachment box is not displayed. It only appears in the form for sending a message to the site administrator
-
I am not aware there would exists such setting (limit attachments to admin only).
I recommend you to create support ticket and describe in detail what is problem and how to reproduce it
-
It seems that maybe it was not understood what the problem is so I am stating it again. I don't care if the attachment box is displayed or not in the message to admin form. I want the attachment box to appear on the message to advertiser form. The problem is probably in this file:
item-send-friend.php
<!-- ITEM CONTACT FORM -->
<form target="_top" action="<?php echo osc_base_url(true) ; ?>" method="post" name="contact_form" id="contact_form" class="fw-box" style="display:block;">
<input type="hidden" name="action" value="contact_post" />
<input type="hidden" name="page" value="item" />
<input type="hidden" name="id" value="<?php echo osc_item_id() ; ?>" />
<?php osc_prepare_user_info() ; ?>
<fieldset>
<div class="head">
<h1><?php _e('Contact seller', 'beta'); ?></h1>
</div>
<div class="middle">
<?php ContactForm::js_validation(); ?>
<ul id="error_list"></ul>
<?php if( osc_item_is_expired () ) { ?>
<div class="problem">
<?php _e('This listing expired, you cannot contact seller.', 'beta') ; ?>
</div>
<?php } else if( (osc_logged_user_id() == osc_item_user_id()) && osc_logged_user_id() != 0 ) { ?>
<div class="problem">
<?php _e('It is your own listing, you cannot contact yourself.', 'beta') ; ?>
</div>
<?php } else if( osc_reg_user_can_contact() && !osc_is_web_user_logged_in() ) { ?>
<div class="problem">
<?php _e('You must log in or register a new account in order to contact the advertiser.', 'beta') ; ?>
</div>
<?php } else { ?>
<?php if(osc_is_web_user_logged_in()) { ?>
<input type="hidden" name="yourName" value="<?php echo osc_esc_html( osc_logged_user_name() ); ?>" />
<input type="hidden" name="yourEmail" value="<?php echo osc_logged_user_email();?>" />
<?php } else { ?>
<div class="row">
<label for="yourName"><?php _e('Name', 'beta') ; ?><span class="req">*</span></label>
<div class="input-box"><?php ContactForm::your_name(); ?></div>
</div>
<div class="row">
<label for="yourEmail"><span><?php _e('E-mail', 'beta') ; ?></span><span class="req">*</span></label>
<div class="input-box"><?php ContactForm::your_email(); ?></div>
</div>
<?php } ?>
<div class="row">
<label for="phoneNumber"><span><?php _e('Phone', 'beta') ; ?></span></label>
<div class="input-box"><?php ContactForm::your_phone_number(); ?></div>
</div>
<div class="row">
<label for="message"><span><?php _e('Message', 'beta'); ?></span><span class="req">*</span></label>
<?php ContactForm::your_message(); ?>
</div>
[u][color=red]IS SOMETHING MISSING HERE?[/color][/u]
<?php osc_run_hook("anr_captcha_form_field"); ?>
<button type="<?php echo (bet_param('forms_ajax') == 1 ? 'button' : 'submit'); ?>" id="send-message" class="mbBg item-form-submit" data-type="contact"><?php _e('Send message', 'beta') ; ?></button>
<?php } ?>
</div>
</fieldset>
</form>
<?php } ?>
<?php if($type == 'contact_public') { ?>
where the code for the attachment box is missing
-
Try this:
<?php if(osc_item_attachment()) { ?>
<div class="row has-file">
<label for="attachment"><?php _e('Attachment', 'beta'); ?>:</label>
<div class="input-box"><?php ContactForm::your_attachment(); ?></div>
</div>
<?php } ?>
-
The box is displayed but the attachment is not transferred to the advertiser. Have you tried? Does it work for you?
-
For ajax submission it will not work. Test with Sigma theme.
-
I have done all the tests you write. Have you tried it if it works? Does it work fine for you?
(Yes on sigma it works normally)
-
@kriskoyk
Can you check if sigma use different piece of code? I am wondering if form has multipart tag added to support attachments/files.
-
Sigma uses this code:
File item-sidebar.php
<?php
/*
* Copyright 2014 Osclass
* Copyright 2021 Osclass by OsclassPoint.com
*
* Osclass maintained & developed by OsclassPoint.com
* You may not use this file except in compliance with the License.
* You may download copy of Osclass at
*
* https://osclass-classifieds.com/download
*
* Do not edit or add to this file if you wish to upgrade Osclass to newer
* versions in the future. Software is distributed on an "AS IS" basis, without
* warranties or conditions of any kind, either express or implied. Do not remove
* this NOTICE section as it contains license information and copyrights.
*/
?>
<div id="sidebar">
<?php if( osc_price_enabled_at_items() ) { ?><div class="price isDesktop isTablet"><?php echo osc_item_formated_price(); ?></div><?php } ?>
<?php if(!osc_is_web_user_logged_in() || osc_logged_user_id()!=osc_item_user_id()) { ?>
<form action="<?php echo osc_base_url(true); ?>" method="post" name="mask_as_form" id="mask_as_form">
<input type="hidden" name="id" value="<?php echo osc_item_id(); ?>" />
<input type="hidden" name="as" value="spam" />
<input type="hidden" name="action" value="mark" />
<input type="hidden" name="page" value="item" />
<select name="as" id="as" class="mark_as">
<option><?php _e("Mark as...", 'sigma'); ?></option>
<option value="spam"><?php _e("Mark as spam", 'sigma'); ?></option>
<option value="badcat"><?php _e("Mark as misclassified", 'sigma'); ?></option>
<option value="repeated"><?php _e("Mark as duplicated", 'sigma'); ?></option>
<option value="expired"><?php _e("Mark as expired", 'sigma'); ?></option>
<option value="offensive"><?php _e("Mark as offensive", 'sigma'); ?></option>
</select>
</form>
<?php } ?>
<?php if( osc_get_preference('sidebar-300x250', 'sigma') != '') {?>
<!-- sidebar ad 350x250 -->
<div class="ads_300">
<?php echo osc_get_preference('sidebar-300x250', 'sigma'); ?>
</div>
<!-- /sidebar ad 350x250 -->
<?php } ?>
<div id="contact" class="widget-box form-container form-vertical">
<h2><?php _e("Contact publisher", 'sigma'); ?></h2>
<?php if(osc_profile_img_users_enabled()) { ?>
<p class="user-img">
<img src="<?php echo osc_user_profile_img_url(osc_item_user_id()); ?>" alt="<?php echo osc_esc_html(osc_item_contact_name()); ?>"/>
</p>
<?php } ?>
<?php if( osc_item_user_id() != null ) { ?>
<p class="name bld"><span><?php _e('Name', 'sigma') ?>:</span> <a href="<?php echo osc_user_public_profile_url( osc_item_user_id() ); ?>" ><?php echo osc_item_contact_name(); ?></a> <?php echo (osc_user_is_online(osc_item_user_id()) ? '<span class="is-online">(' . __('online', 'sigma') . ')</span>' : ''); ?></p>
<?php } else { ?>
<p class="name bld"><span><?php _e('Name', 'sigma'); ?>:</span> <?php echo osc_item_contact_name(); ?></p>
<?php } ?>
<?php if( osc_item_show_email() ) { ?>
<p class="email bld"><span><?php _e('E-mail', 'sigma'); ?>:</span> <a href="mailto:<?php echo osc_item_contact_email(); ?>"><?php echo osc_item_contact_email(); ?></a></p>
<?php } ?>
<?php if ( osc_item_contact_phone() != '' && osc_item_show_phone()) { ?>
<p class="phone bld"><span><?php _e('Phone', 'sigma'); ?>:</span> <?php echo '<a href="tel:' . osc_item_contact_phone(true) . '">' . osc_item_contact_phone(false) . '</a>'; ?></p>
<?php } ?>
<?php if ( osc_item_contact_other() != '' ) { ?>
<p class="other bld"><span><?php _e('Other', 'sigma'); ?>:</span> <?php echo osc_item_contact_other(); ?></p>
<?php } ?>
<a href="#contact-in" class="resp-toogle btn btn-secondary show-contact-btn"><?php _e('Contact seller', 'sigma'); ?></a>
<div id="contact-in" class="fixed-layout">
<div class="fixed-close"><i class="fas fa-times"></i></div>
<?php if( osc_item_is_expired () ) { ?>
<p class="problem expired">
<?php _e("The listing is expired. You can't contact the publisher.", 'sigma'); ?>
</p>
<?php } else if( ( osc_logged_user_id() == osc_item_user_id() ) && osc_logged_user_id() != 0 ) { ?>
<p class="problem own">
<?php _e("It's your own listing, you can't contact the publisher.", 'sigma'); ?>
</p>
<?php } else if( osc_reg_user_can_contact() && !osc_is_web_user_logged_in() ) { ?>
<p class="problem unlogged">
<?php _e("You must log in or register a new account in order to contact the advertiser", 'sigma'); ?>
</p>
<a href="<?php echo osc_user_login_url(); ?>" class="btn btn-secondary lgn"><?php _e('Login', 'sigma'); ?></a>
<?php } else { ?>
<ul id="error_list"></ul>
<form action="<?php echo osc_base_url(true); ?>" method="post" name="contact_form" id="contact_form" <?php if(osc_item_attachment()) { echo 'enctype="multipart/form-data"'; };?> >
<?php osc_prepare_user_info(); ?>
<input type="hidden" name="action" value="contact_post" />
<input type="hidden" name="page" value="item" />
<input type="hidden" name="id" value="<?php echo osc_item_id(); ?>" />
<div class="control-group">
<label class="control-label" for="yourName"><?php _e('Your name', 'sigma'); ?>:</label>
<div class="controls"><?php ContactForm::your_name(); ?></div>
</div>
<div class="control-group">
<label class="control-label" for="yourEmail"><?php _e('Your e-mail address', 'sigma'); ?>:</label>
<div class="controls"><?php ContactForm::your_email(); ?></div>
</div>
<div class="control-group">
<label class="control-label" for="phoneNumber"><?php _e('Phone number', 'sigma'); ?> (<?php _e('optional', 'sigma'); ?>):</label>
<div class="controls"><?php ContactForm::your_phone_number(); ?></div>
</div>
<div class="control-group">
<label class="control-label" for="message"><?php _e('Message', 'sigma'); ?>:</label>
<div class="controls textarea"><?php ContactForm::your_message(); ?></div>
</div>
<?php if(osc_item_attachment()) { ?>
<div class="control-group">
<label class="control-label" for="attachment"><?php _e('Attachment', 'sigma'); ?>:</label>
<div class="controls"><?php ContactForm::your_attachment(); ?></div>
</div>
<?php }; ?>
<div class="control-group">
<div class="controls">
<?php osc_run_hook('item_contact_form', osc_item_id()); ?>
<?php osc_show_recaptcha(); ?>
<button type="submit" class="btn btn-primary"><?php _e("Send", 'sigma');?></button>
</div>
</div>
</form>
<?php ContactForm::js_validation(); ?>
<?php } ?>
</div>
</div>
<div id="useful_info">
<h2><?php _e('Useful information', 'sigma'); ?></h2>
<ul>
<li><?php _e('Avoid scams by acting locally or paying with PayPal', 'sigma'); ?></li>
<li><?php _e('Never pay with Western Union, Moneygram or other anonymous payment services', 'sigma'); ?></li>
<li><?php _e('Don\'t buy or sell outside of your country. Don\'t accept cashier cheques from outside your country', 'sigma'); ?></li>
<li><?php _e('This site is never involved in any transaction, and does not handle payments, shipping, guarantee transactions, provide escrow services, or offer "buyer protection" or "seller certification"', 'sigma'); ?></li>
</ul>
</div>
</div><!-- /sidebar -->
-
Giving into attention code tag (#) you can use for inserting code here.
This is part I was talking about:
<?php if(osc_item_attachment()) { echo 'enctype="multipart/form-data"'; };?>
-
I didn't understand your last question, do I need to do something with the code you wrote?
(I did a test by putting the code here:
item-send-friend.php
..............................................
<!-- ITEM CONTACT FORM -->
<form target="_top" action="<?php echo osc_base_url(true) ; ?>" method="post" name="contact_form" id="contact_form" <?php if(osc_item_attachment()) { echo 'enctype="multipart/form-data"'; };?> class="fw-box" style="display:block;">
<input type="hidden" name="action" value="contact_post" />
<input type="hidden" name="page" value="item" />
<input type="hidden" name="id" value="<?php echo osc_item_id() ; ?>" />
but it didn't work)
-
yes it's needed as form must have enctype="multipart/form-data" attribute to be able to transfer attachments.
-
It worked!!! I placed the code as you said and disabled the "Form submission without reloading" (Ajax) which was enabled until now and everything works fine. Thanks for your help and patience.
-
Welcome.
Files cannot be submitted via ajax.